From 8dd29476c08920c76e25d5f36cc358e9eeaeab6f Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Wed, 21 Jun 2017 09:22:59 -0500 Subject: [PATCH] some cleanup of routes --- app/Providers/AppServiceProvider.php | 4 --- app/Providers/RouteServiceProvider.php | 3 --- composer.json | 3 +-- config/app.php | 2 +- routes/admin.php | 34 +++++++++++++++++--------- routes/web.php | 34 +++----------------------- 6 files changed, 28 insertions(+), 52 deletions(-) diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index a1133a4e..c4379642 100755 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -33,9 +33,5 @@ class AppServiceProvider extends ServiceProvider $this->app->bind('App\Services\AircraftFareService', function($app) { return new \App\Services\AircraftFareService(); }); - - if (in_array($this->app->environment(), ['local', 'dev', 'unittest'])) { - $this->app->register(\Bpocallaghan\Generators\GeneratorsServiceProvider::class); - } } } diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 97c656b0..334599a9 100755 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -36,10 +36,7 @@ class RouteServiceProvider extends ServiceProvider public function map() { $this->mapWebRoutes(); - $this->mapApiRoutes(); - - // } /** diff --git a/composer.json b/composer.json index 8e3218a5..a97630f2 100755 --- a/composer.json +++ b/composer.json @@ -29,8 +29,7 @@ "phpunit/phpunit": "~5.7", "symfony/css-selector": "3.1.*", "symfony/dom-crawler": "3.1.*", - "laravel/homestead": "^5.4", - "bpocallaghan/generators": "^4.0" + "laravel/homestead": "^5.4" }, "autoload": { "classmap": [ diff --git a/config/app.php b/config/app.php index cb57d2c6..4410c59f 100755 --- a/config/app.php +++ b/config/app.php @@ -110,7 +110,7 @@ return [ 'Flash' => Laracasts\Flash\Flash::class, 'Yaml' => Symfony\Component\Yaml\Yaml::class, 'Geotools' => Toin0u\Geotools\Facade\Geotools::class, - 'Setting' => 'anlutro\LaravelSettings\Facade', + 'Setting' => anlutro\LaravelSettings\Facade::class, ], ]; diff --git a/routes/admin.php b/routes/admin.php index b70d8311..0553db2f 100644 --- a/routes/admin.php +++ b/routes/admin.php @@ -1,21 +1,31 @@ ['role:admin'], - 'uses' => 'Http\Controllers\Admin\DashboardController@index' -]); - Route::group([ - 'namespace' => 'Http\Controllers\Admin', - //'middleware' => ['role:admin'], - 'prefix' => 'admin', -], function () { + 'namespace' => 'Admin', 'prefix' => 'admin', 'as' => 'admin.', + 'middleware' => ['role:admin'], + ], function () { Route::resource('airports', 'AirportController'); Route::resource('airlines', 'AirlinesController'); - Route::resource('aircraft', 'AircraftController'); Route::resource('aircraftclasses', 'AircraftClassController'); Route::resource('fares', 'FareController'); -});*/ + + # aircraft and fare associations + Route::resource('aircraft', 'AircraftController'); + Route::match(['get', 'post', 'put', 'delete'], 'aircraft/{id}/fares', 'AircraftController@fares'); + + # flights and aircraft associations + Route::resource('flights', 'FlightController'); + Route::match(['get', 'post', 'put', 'delete'], 'flights/{id}/aircraft', 'FlightController@aircraft'); + + # view/update settings + Route::match(['get'], 'settings', 'SettingsController@index'); + Route::match(['post', 'put'], 'settings', 'SettingsController@update'); + + # defaults + Route::get('', ['uses' => 'DashboardController@index']); + Route::get('/', ['uses' => 'DashboardController@index']); + Route::get('/dashboard', ['uses' => 'DashboardController@index', 'name' => 'dashboard']); +}); diff --git a/routes/web.php b/routes/web.php index ad105afd..aae2f422 100755 --- a/routes/web.php +++ b/routes/web.php @@ -4,6 +4,9 @@ Route::get('/', 'HomeController@index'); Route::get('/home', 'HomeController@index'); +/** + * These are only visible to a logged in user + */ Route::group([ 'namespace' => 'Frontend', 'prefix' => 'frontend', 'as' => 'frontend.', 'middleware' => ['role:admin|user'], @@ -13,33 +16,4 @@ Route::group([ Auth::routes(); -/** - * Admin Routes - */ - -Route::group([ - 'namespace' => 'Admin', 'prefix' => 'admin', 'as' => 'admin.', - 'middleware' => ['role:admin'], -], function () { - Route::resource('airports', 'AirportController'); - Route::resource('airlines', 'AirlinesController'); - Route::resource('aircraftclasses', 'AircraftClassController'); - Route::resource('fares', 'FareController'); - - # aircraft and fare associations - Route::resource('aircraft', 'AircraftController'); - Route::match(['get', 'post', 'put', 'delete'], 'aircraft/{id}/fares', 'AircraftController@fares'); - - # flights and aircraft associations - Route::resource('flights', 'FlightController'); - Route::match(['get', 'post', 'put', 'delete'], 'flights/{id}/aircraft', 'FlightController@aircraft'); - - # view/update settings - Route::match(['get'], 'settings', 'SettingsController@index'); - Route::match(['post', 'put'], 'settings', 'SettingsController@update'); - - # defaults - Route::get('', ['uses' => 'DashboardController@index']); - Route::get('/', ['uses' => 'DashboardController@index']); - Route::get('/dashboard', ['uses' => 'DashboardController@index','name' => 'dashboard']); -}); +require base_path('routes/admin.php');