This commit is contained in:
2018-11-13 21:38:15 -06:00
parent 0721a70ef5
commit aea893f80d
2 changed files with 8 additions and 14 deletions

View File

@@ -84,17 +84,14 @@ class FleetsController extends Controller
]);
$fleet->SetFleetEndTime($endTime);
//Return the view with the success message
return view('fleets.displayfleets')->with('success', 'Fleet registered.');
} else {
//Return the view with the error message of the fleet has been found already.
return view('fleets.displayfleets')->with('error', 'Fleet already in the database.');
}
}
return redirect('/fleets/display');
}
public function deleteFleet($fleetId) {
DB::table('Fleets')->where('fleet', $fleetId)->delete();
return view('fleets.displayfleets')->with('success', 'Fleet deleted.');
return redirect('/fleets/display');
}
public function addPilot($fleetId, $charId) {
@@ -102,11 +99,8 @@ class FleetsController extends Controller
$fleet = DB::table('Fleets')->where('fleet', $fleetId)->get();
//Add a pilot to the fleet
$error = $fleet->AddPilot($fleet->character_id, $charId);
if($error) {
return view('fleets.displaystanding')->with('error', 'Unable to add to fleet.');
} else {
return view('fleets.displaystanding')->with('success', 'Pilot added to fleet.');
}
return redirect('/fleets/display');
}
public function updateFleet() {
@@ -114,6 +108,6 @@ class FleetsController extends Controller
$fleet = session('fleet');
$fleet->UpdateFleet($request->isFreeMove, $request->motd);
return view('fleets.displaystanding')->with('success', 'Fleet updated.');
return redirect('/fleets/display');
}
}

View File

@@ -5,7 +5,7 @@
@for($i = 0; $i < count($data[0]); $i++)
<a href="{{ route('addpilot', [$data[1][$i], Auth::user()->character_id]) }}">Join {{ $data[2][$i] }}</a><br>
@if(Auth::user()->character_id == $data[0][$i])
<a href="{{ route('deletefleet', [$data[0][$i]]) }}">Delete Fleet</a><br><br>
<a href="{{ route('deletefleet', [$data[1][$i]]) }}">Delete Fleet</a><br><br>
@endif
@endfor
</div>