diff --git a/app/Http/Controllers/EsiScopeController.php b/app/Http/Controllers/EsiScopeController.php new file mode 100644 index 000000000..38aa87471 --- /dev/null +++ b/app/Http/Controllers/EsiScopeController.php @@ -0,0 +1,39 @@ +middleware('auth'); + $this->middleware('role:User'); + } + + public function displayScopes() { + return view('scopes.select'); + } + + public function redirectToProvider(Request $request) { + //Set the array to build it + $scopes = array(); + $i = 0; + foreach($request as $req) { + $scopes[$i] = $req; + $i++; + } + + return Socialite::driver('eveonline')->setScopes($scopes)->redirect(); + } + +} diff --git a/app/Http/Controllers/FinancesController.php b/app/Http/Controllers/FinancesController.php index 519b65b84..de87a0ae6 100644 --- a/app/Http/Controllers/FinancesController.php +++ b/app/Http/Controllers/FinancesController.php @@ -21,14 +21,6 @@ class FinancesController extends Controller $this->middleware('role:Admin'); } - public function redirectToProvider() { - if(!Auth::check()) { - return redirect()->to('/'); - } - - return Socialite::driver('eveonline')->setScopes(['publicData', 'esi-wallet.read_corporation_wallets.v1'])->redirect(); - } - public function displayWallet() { $esi = new \App\Library\Finances(); diff --git a/app/Http/Controllers/FleetsController.php b/app/Http/Controllers/FleetsController.php index 5ab07c082..825f337b6 100644 --- a/app/Http/Controllers/FleetsController.php +++ b/app/Http/Controllers/FleetsController.php @@ -8,5 +8,30 @@ class FleetsController extends Controller { public function __construct() { $this->middleware('auth'); + $this->middleware('role:User'); + } + + public function displayRegisterFleet() { + return view('fleets.registerfleet'); + } + + public function displayStandingFleet() { + return view('fleets.displaystanding'); + } + + public function registerFleet() { + + } + + public function createWing() { + + } + + public function createSquad() { + + } + + public function addPilot() { + } } diff --git a/app/Library/Esi.php b/app/Library/Esi.php new file mode 100644 index 000000000..e40116d81 --- /dev/null +++ b/app/Library/Esi.php @@ -0,0 +1,30 @@ +where('character_id', $charId)->get(); + foreach($checks as $check) { + if($check === $scope){ + return true; + } + } + + return false; + } + +} + +?> \ No newline at end of file diff --git a/app/Library/Finances.php b/app/Library/Finances.php index bc01dbcb1..4afd10d26 100644 --- a/app/Library/Finances.php +++ b/app/Library/Finances.php @@ -7,8 +7,8 @@ namespace App\Library; - use Illuminate\Http\Request; - use Session; +use Illuminate\Http\Request; +use Session; use DB; use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Client; @@ -25,7 +25,8 @@ class Finances { private $esi; - public function __construct() { + public function __construct($charId = null) { + $user = DB::table('users')->where('name', 'Minerva Arbosa')->first(); $authentication = new \Seat\Eseye\Containers\EsiAuthentication([ @@ -35,8 +36,6 @@ class Finances { ]); $this->esi = new \Seat\Eseye\Eseye($authentication); - - } public function GetMarketGroups() { diff --git a/app/Library/Fleet.php b/app/Library/Fleet.php index ab426a07d..178af690c 100644 --- a/app/Library/Fleet.php +++ b/app/Library/Fleet.php @@ -2,42 +2,97 @@ namespace App\Library; -use Illuminate\Http\Request; -use App\Http\Controllers\Controller; use Session; use DB; -use GuzzleHttp\Exception\GuzzleException; + +use Seat\Eseye\Cache\NullCache; +use Seat\Eseye\Configuration; +use Seat\Eseye\Containers\EsiAuthentication; +use Seat\Eseye\Eseye; class Fleet { + /** + * Get fleet information + */ + public function GetFleetInfo($uri) { + + } + + /** + * Update fleet information + */ + public function UpdateFleet($fleet) { + + } + /** * Create a standing fleet from a registered fleet. */ - public function createStandingFleet() { + public function CreateStandingFleet($fleet) { } /** * Join the standing fleet */ - public function joinStandingFleet($fleet) { + public function JoinStandingFleet($fleet, $charId) { } - public function leaveStandingFleet() { + /** + * Leave the standing fleet + */ + public function LeaveStandingFleet($fleet, $charId) { } - public function createNewWing() { + /** + * Create new wing in a fleet + */ + public function CreateNewWing($fleet) { } - public function createNewSquad() { + /** + * Create new squad in a fleet + */ + public function CreateNewSquad($fleet) { } - public function modifyMOTD() { + /** + * Modify the MotD of a fleet + */ + public function ModifyMOTD($fleet) { } + + /** + * Get a fleet's squads + */ + public function GetSquads($fleet) { + + } + + /** + * Rename a fleet's squad + */ + public function RenameSquad($fleet, $squad, $name) { + + } + /** + * Get fleet's wings + */ + public function GetWings($fleet) { + + } + + /** + * Rename a fleet wing + */ + public function RenameWing($fleet, $wing, $name) { + + } } ?> \ No newline at end of file diff --git a/resources/views/fleets/displaystanding.blade.php b/resources/views/fleets/displaystanding.blade.php new file mode 100644 index 000000000..528eb3a46 --- /dev/null +++ b/resources/views/fleets/displaystanding.blade.php @@ -0,0 +1,12 @@ +@extends('layouts.b4') +@section('content') +
+

Standing Fleet

+ Join Standing Fleet + @if($fleetCommander == true) + Create Wing + Create Squad + @endif + Display some other cool stuff about the fleet +
+@endsection \ No newline at end of file diff --git a/resources/views/fleets/registerfleet.blade.php b/resources/views/fleets/registerfleet.blade.php new file mode 100644 index 000000000..f71192984 --- /dev/null +++ b/resources/views/fleets/registerfleet.blade.php @@ -0,0 +1,13 @@ +@extends('layouts.b4') +@section('content') +
+

Register A New Fleet

+ {!! Form::open(['action' => 'FleetsController@registerFleet', 'method' => 'POST']) !!} +
+ {{ Form::label('fleet', 'Fleet') }} + {{ Form::text('fleet', '', ['class' => 'form-control', 'placeholder' => 'Fleet URL']) }} +
+ {{ Form::submit('Submit', ['class' => 'btn btn-primary']) }} + {!! Form::close() !!} +
+@endsection \ No newline at end of file diff --git a/resources/views/fleets/registerstanding.blade.php b/resources/views/fleets/registerstanding.blade.php deleted file mode 100644 index f7e4ca1d9..000000000 --- a/resources/views/fleets/registerstanding.blade.php +++ /dev/null @@ -1 +0,0 @@ -Register Standing Work in Progress! \ No newline at end of file diff --git a/resources/views/scopes/select.blade.php b/resources/views/scopes/select.blade.php new file mode 100644 index 000000000..4057c9e21 --- /dev/null +++ b/resources/views/scopes/select.blade.php @@ -0,0 +1,29 @@ +@extends('layout.b4'); +@section('content') +
+

Select Scopes for ESI

+ {!! From::open(['action' => 'EsiScopeController@redirectToProvider', 'method' => 'POST']) !!} +
+ {{ Form::label('scopes[]', 'Public Data') }} + {{ Form::checkbox('scopes[]', 'publicData') }} + {{ Form::label('scopes[]', 'Write Fleet') }} + {{ Form::checkbox('scopes[]', 'esi-fleets.write_fleet.v1') }} + {{ Form::label('scopes[]', 'Read Fleet') }} + {{ Form::checkbox('scopes[]', 'esi-fleets.read_fleet.v1') }} + {{ Form::label('scopes[]', 'Read Location') }} + {{ Form::checkbox('scopes[]', 'esi-location.read_location.v1') }} + {{ Form::label('scopes[]', 'Write Mail') }} + {{ Form::checkbox('scopes[]', 'esi-mail.send_mail.v1') }} + {{ Form::label('scopes[]', 'Read Mail') }} + {{ Form::label('scopes[]', 'esi-mail.read_mail.v1')}} + {{ Form::label('scopes[]', 'Corporation Wallets') }} + {{ Form::checkbox('scopes[]', 'esi-wallet.read_corporation_wallets.v1') }} + {{ Form::label('scopes[]', 'Read Structures') }} + {{ Form::checkbox('scopes[]', 'esi-corporations.read_structures.v1') }} + {{ Form::label('scopes[]', 'Structure Markets') }} + {{ Form::checkbox('scopes[]', 'esi-markets.structure_markets.v1') }} +
+ {{ Form::submit('Submit', ['class' => 'btn btn-primary']) }} + {!! Form::close() !!} +
+@endsection \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index 7458808d7..9576f0c3e 100644 --- a/routes/web.php +++ b/routes/web.php @@ -19,6 +19,7 @@ Route::get('/', function () { Route::get('/login', 'Auth\LoginController@redirectToProvider')->name('login'); Route::get('/callback', 'Auth\LoginController@handleProviderCallback')->name('callback'); Route::get('/logout', 'Auth\LoginController@logout')->name('logout'); + //Dashboard Controller Display pages Route::get('/dashboard', 'DashboardController@index'); @@ -26,13 +27,10 @@ Route::get('/dashboard', 'DashboardController@index'); Route::get('/moons/display', 'MoonsController@displayMoons'); Route::get('/moons/addmoon', 'MoonsController@addMoon'); Route::get('/moons/updatemoon', 'MoonsController@updateMoon'); -//Route::get('/moons/worth', 'MoonsController@displayWorth'); -//Route::get('/moons/mined', 'MoonsController@displayMined'); + //Moon Controller POST requests Route::post('storeMoon', 'MoonsController@storeMoon'); Route::post('storeUpdateMoon', 'MoonsController@storeUpdateMoon'); -//Route::post('worth', 'MoonsController@displayMoonWorth'); -//Route::post('mined', 'MoonsController@displayMoonMined'); //Wiki Controller display pages Route::get('/wiki/register', 'WikiController@displayRegister'); @@ -41,6 +39,14 @@ Route::get('/wiki/changepassword', 'WikiController@displayChangePassword'); Route::post('storeRegister', 'WikiController@storeRegister'); Route::post('changePassword', 'WikiController@changePassword'); -//Finance Controller display pages -Route::get('/finances/login', 'FinancesController@redirectToProvider'); -Route::get('/finances/display/wallet', 'FinancesController@displayWallet'); \ No newline at end of file +//Scopes Controller display pages +Route::get('/scopes/select', 'EsiScopeController@displayScopes'); +Route::post('redirectToProvider', 'EsiScopeController@redirectToProvider'); + +//Fleet Controller display pages +Route::get('/fleets/display'); +Route::get('/fleets/register', 'FleetsController@displayRegisterFleet'); +Route::get('/fleets/standing', 'FleetsController@displayStandingFleet'); +Route::get('/fleets/addpilot/{id}', 'FleetsController@addPilot'); +Route::get('/fleets/{id}/createwing', 'FleetsController@createWing'); +Route::get('/fleets/{id}/createsquad', 'FleetsController@createSquad'); \ No newline at end of file