This commit is contained in:
2018-11-13 00:01:31 -06:00
parent 60a7d91c55
commit 4673649bf4
2 changed files with 21 additions and 6 deletions

View File

@@ -65,8 +65,6 @@ class FleetsController extends Controller
$fleet->SetFleetEndTime($endTime);
//Set the fleet into the session to be used later
session(['fleet' => $fleet]);
$fleet = session('fleet');
dd($fleet);
//Return the view with the success message
return view('fleets.displayfleets')->with('success', 'Fleet registered.');
@@ -81,7 +79,7 @@ class FleetsController extends Controller
$fleet = session('fleet');
dd($fleet);
//Add a pilot to the fleet
$error = $fleet->AddPilot(Auth::user()->character_id);
$error = $fleet->AddPilot($id);
if($error) {
return view('fleets.displaystanding')->with('error', 'Unable to add to fleet.');
} else {
@@ -89,9 +87,9 @@ class FleetsController extends Controller
}
}
public function updateFleet(Request $request) {
public function updateFleet() {
//Retrieve the fleet from the session
$fleet = $request->session()->get('fleet');
$fleet = session('fleet');
$fleet->UpdateFleet($request->isFreeMove, $request->motd);
return view('fleets.displaystanding')->with('success', 'Fleet updated.');

View File

@@ -82,7 +82,24 @@ class Fleet {
public function AddPilot($charId) {
//Get the ESI token for the FC to add the new pilot
$token = DB::table('EsiTokens')->where('character_id', $this->fcId)->first();
//Create the ESI Call
//Create the ESI Call Container
$authentication = new EsiAuthentication([
'client_id' => env('ESI_CLIENT_ID'),
'secret' => env('ESI_SECRET_KEY'),
'refresh_token' => $token->refresh_token,
]);
//Crate the ESI Class
$esi = new Eseye($authentication);
//Perform the call to ESI
$error = $esi->invoke('post', '/fleets/{fleet_id}/members/', [
'fleet_id' => $this->fleet,
'invitation' => [
'character_id' => $charId,
'role' => 'squad_member',
],
]);
return $error;
}
public function RenderFleetDisplay() {