some cleanup of routes

This commit is contained in:
Nabeel Shahzad 2017-06-21 09:22:59 -05:00
parent 807316fd0e
commit 8dd29476c0
6 changed files with 28 additions and 52 deletions

View File

@ -33,9 +33,5 @@ class AppServiceProvider extends ServiceProvider
$this->app->bind('App\Services\AircraftFareService', function($app) { $this->app->bind('App\Services\AircraftFareService', function($app) {
return new \App\Services\AircraftFareService(); return new \App\Services\AircraftFareService();
}); });
if (in_array($this->app->environment(), ['local', 'dev', 'unittest'])) {
$this->app->register(\Bpocallaghan\Generators\GeneratorsServiceProvider::class);
}
} }
} }

View File

@ -36,10 +36,7 @@ class RouteServiceProvider extends ServiceProvider
public function map() public function map()
{ {
$this->mapWebRoutes(); $this->mapWebRoutes();
$this->mapApiRoutes(); $this->mapApiRoutes();
//
} }
/** /**

View File

@ -29,8 +29,7 @@
"phpunit/phpunit": "~5.7", "phpunit/phpunit": "~5.7",
"symfony/css-selector": "3.1.*", "symfony/css-selector": "3.1.*",
"symfony/dom-crawler": "3.1.*", "symfony/dom-crawler": "3.1.*",
"laravel/homestead": "^5.4", "laravel/homestead": "^5.4"
"bpocallaghan/generators": "^4.0"
}, },
"autoload": { "autoload": {
"classmap": [ "classmap": [

View File

@ -110,7 +110,7 @@ return [
'Flash' => Laracasts\Flash\Flash::class, 'Flash' => Laracasts\Flash\Flash::class,
'Yaml' => Symfony\Component\Yaml\Yaml::class, 'Yaml' => Symfony\Component\Yaml\Yaml::class,
'Geotools' => Toin0u\Geotools\Facade\Geotools::class, 'Geotools' => Toin0u\Geotools\Facade\Geotools::class,
'Setting' => 'anlutro\LaravelSettings\Facade', 'Setting' => anlutro\LaravelSettings\Facade::class,
], ],
]; ];

View File

@ -1,21 +1,31 @@
<?php <?php
/** /**
* Admin routes * Admin Routes
*/ */
/*Route::get('/admin', [
'middleware' => ['role:admin'],
'uses' => 'Http\Controllers\Admin\DashboardController@index'
]);
Route::group([ Route::group([
'namespace' => 'Http\Controllers\Admin', 'namespace' => 'Admin', 'prefix' => 'admin', 'as' => 'admin.',
//'middleware' => ['role:admin'], 'middleware' => ['role:admin'],
'prefix' => 'admin', ], function () {
], function () {
Route::resource('airports', 'AirportController'); Route::resource('airports', 'AirportController');
Route::resource('airlines', 'AirlinesController'); Route::resource('airlines', 'AirlinesController');
Route::resource('aircraft', 'AircraftController');
Route::resource('aircraftclasses', 'AircraftClassController'); Route::resource('aircraftclasses', 'AircraftClassController');
Route::resource('fares', 'FareController'); 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']);
});

View File

@ -4,6 +4,9 @@ Route::get('/', 'HomeController@index');
Route::get('/home', 'HomeController@index'); Route::get('/home', 'HomeController@index');
/**
* These are only visible to a logged in user
*/
Route::group([ Route::group([
'namespace' => 'Frontend', 'prefix' => 'frontend', 'as' => 'frontend.', 'namespace' => 'Frontend', 'prefix' => 'frontend', 'as' => 'frontend.',
'middleware' => ['role:admin|user'], 'middleware' => ['role:admin|user'],
@ -13,33 +16,4 @@ Route::group([
Auth::routes(); Auth::routes();
/** require base_path('routes/admin.php');
* 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']);
});