2017-06-10 03:47:02 +08:00
|
|
|
<?php
|
|
|
|
/**
|
2017-06-21 22:22:59 +08:00
|
|
|
* Admin Routes
|
2017-06-10 03:47:02 +08:00
|
|
|
*/
|
2019-12-25 16:31:09 +08:00
|
|
|
use Illuminate\Support\Facades\Route;
|
|
|
|
|
|
|
|
Route::group(
|
|
|
|
[
|
|
|
|
'namespace' => 'Admin',
|
|
|
|
'prefix' => 'admin',
|
|
|
|
'as' => 'admin.',
|
|
|
|
'middleware' => ['auth', 'ability:admin,admin-access'],
|
|
|
|
],
|
|
|
|
static function () {
|
|
|
|
// CRUD for airlines
|
2020-01-30 22:23:31 +08:00
|
|
|
Route::resource('airlines', 'AirlinesController')->middleware('ability:admin,airlines');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
|
|
|
// CRUD for roles
|
2020-01-30 22:23:31 +08:00
|
|
|
Route::resource('roles', 'RolesController')->middleware('role:admin');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
2020-01-30 22:23:31 +08:00
|
|
|
Route::get('airports/export', 'AirportController@export')
|
|
|
|
->name('airports.export')
|
|
|
|
->middleware('ability:admin,airports');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
2020-01-30 22:23:31 +08:00
|
|
|
Route::match(['get', 'post', 'put'], 'airports/fuel', 'AirportController@fuel')
|
|
|
|
->middleware('ability:admin,airports');
|
|
|
|
|
|
|
|
Route::match(['get', 'post'], 'airports/import', 'AirportController@import')
|
|
|
|
->name('airports.import')->middleware('ability:admin,airports');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
|
|
|
Route::match(
|
|
|
|
['get', 'post', 'put', 'delete'],
|
|
|
|
'airports/{id}/expenses',
|
|
|
|
'AirportController@expenses'
|
2020-01-30 22:23:31 +08:00
|
|
|
)->middleware('ability:admin,airports');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
2020-01-30 22:23:31 +08:00
|
|
|
Route::resource('airports', 'AirportController')->middleware('ability:admin,airports');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
|
|
|
// Awards
|
2020-01-30 22:23:31 +08:00
|
|
|
Route::resource('awards', 'AwardController')->middleware('ability:admin,awards');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
|
|
|
// aircraft and fare associations
|
2020-01-30 22:23:31 +08:00
|
|
|
Route::get('aircraft/export', 'AircraftController@export')
|
|
|
|
->name('aircraft.export')
|
|
|
|
->middleware('ability:admin,aircraft');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
2020-01-30 22:23:31 +08:00
|
|
|
Route::match(['get', 'post'], 'aircraft/import', 'AircraftController@import')
|
|
|
|
->name('aircraft.import')->middleware('ability:admin,aircraft');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
|
|
|
Route::match(
|
|
|
|
['get', 'post', 'put', 'delete'],
|
|
|
|
'aircraft/{id}/expenses',
|
|
|
|
'AircraftController@expenses'
|
2020-01-30 22:23:31 +08:00
|
|
|
)->middleware('ability:admin,aircraft');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
2020-01-30 22:23:31 +08:00
|
|
|
Route::resource('aircraft', 'AircraftController')->middleware('ability:admin,aircraft');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
|
|
|
// expenses
|
2020-01-30 22:23:31 +08:00
|
|
|
Route::get('expenses/export', 'ExpenseController@export')
|
|
|
|
->name('expenses.export')
|
|
|
|
->middleware('ability:admin,finances');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
2020-01-30 22:23:31 +08:00
|
|
|
Route::match(['get', 'post'], 'expenses/import', 'ExpenseController@import')
|
|
|
|
->name('expenses.import')
|
|
|
|
->middleware('ability:admin,finances');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
2020-01-30 22:23:31 +08:00
|
|
|
Route::resource('expenses', 'ExpenseController')->middleware('ability:admin,finances');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
|
|
|
// fares
|
2020-01-30 22:23:31 +08:00
|
|
|
Route::get('fares/export', 'FareController@export')
|
|
|
|
->name('fares.export')
|
|
|
|
->middleware('ability:admin,finances');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
2020-01-30 22:23:31 +08:00
|
|
|
Route::match(['get', 'post'], 'fares/import', 'FareController@import')
|
|
|
|
->name('fares.import')->middleware('ability:admin,finances');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
2020-01-30 22:23:31 +08:00
|
|
|
Route::resource('fares', 'FareController')->middleware('ability:admin,finances');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
|
|
|
// files
|
2020-01-30 22:23:31 +08:00
|
|
|
Route::post('files', 'FileController@store')
|
|
|
|
->name('files.store')
|
|
|
|
->middleware('ability:admin,files');
|
|
|
|
|
|
|
|
Route::delete('files/{id}', 'FileController@destroy')
|
|
|
|
->name('files.delete')
|
|
|
|
->middleware('ability:admin,files');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
|
|
|
// finances
|
2020-01-30 22:23:31 +08:00
|
|
|
Route::resource('finances', 'FinanceController')->middleware('ability:admin,finances');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
|
|
|
// flights and aircraft associations
|
2020-01-30 22:23:31 +08:00
|
|
|
Route::get('flights/export', 'FlightController@export')
|
|
|
|
->name('flights.export')
|
|
|
|
->middleware('ability:admin,flights');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
2020-01-30 22:23:31 +08:00
|
|
|
Route::match(['get', 'post'], 'flights/import', 'FlightController@import')
|
|
|
|
->name('flights.import')
|
|
|
|
->middleware('ability:admin,flights');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
|
|
|
Route::match(
|
|
|
|
['get', 'post', 'put', 'delete'],
|
|
|
|
'flights/{id}/fares',
|
|
|
|
'FlightController@fares'
|
2020-01-30 22:23:31 +08:00
|
|
|
)->middleware('ability:admin,flights');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
|
|
|
Route::match(
|
|
|
|
['get', 'post', 'put', 'delete'],
|
|
|
|
'flights/{id}/fields',
|
|
|
|
'FlightController@field_values'
|
2020-01-30 22:23:31 +08:00
|
|
|
)->middleware('ability:admin,flights');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
|
|
|
Route::match(
|
|
|
|
['get', 'post', 'put', 'delete'],
|
|
|
|
'flights/{id}/subfleets',
|
|
|
|
'FlightController@subfleets'
|
2020-01-30 22:23:31 +08:00
|
|
|
)->middleware('ability:admin,flights');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
2020-01-30 22:23:31 +08:00
|
|
|
Route::resource('flights', 'FlightController')
|
|
|
|
->middleware('ability:admin,flights');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
2020-01-30 22:23:31 +08:00
|
|
|
Route::resource('flightfields', 'FlightFieldController')
|
|
|
|
->middleware('ability:admin,flights');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
|
|
|
// pirep related routes
|
2020-01-30 22:23:31 +08:00
|
|
|
Route::get('pireps/fares', 'PirepController@fares')->middleware('ability:admin,pireps');
|
|
|
|
Route::get('pireps/pending', 'PirepController@pending')->middleware('ability:admin,pireps');
|
|
|
|
Route::resource('pireps', 'PirepController')->middleware('ability:admin,pireps');
|
|
|
|
|
|
|
|
Route::match(['get', 'post', 'delete'], 'pireps/{id}/comments', 'PirepController@comments')
|
|
|
|
->middleware('ability:admin,pireps');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
2020-01-30 22:23:31 +08:00
|
|
|
Route::match(['post', 'put'], 'pireps/{id}/status', 'PirepController@status')
|
|
|
|
->name('pirep.status')
|
|
|
|
->middleware('ability:admin,pireps');
|
|
|
|
|
|
|
|
Route::resource('pirepfields', 'PirepFieldController')
|
|
|
|
->middleware('ability:admin,pireps');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
|
|
|
// rankings
|
2020-01-30 22:23:31 +08:00
|
|
|
Route::resource('ranks', 'RankController')->middleware('ability:admin,ranks');
|
2019-12-25 16:31:09 +08:00
|
|
|
Route::match(
|
|
|
|
['get', 'post', 'put', 'delete'],
|
|
|
|
'ranks/{id}/subfleets',
|
|
|
|
'RankController@subfleets'
|
2020-01-30 22:23:31 +08:00
|
|
|
)->middleware('ability:admin,ranks');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
|
|
|
// settings
|
2020-01-30 22:23:31 +08:00
|
|
|
Route::match(['get'], 'settings', 'SettingsController@index')
|
|
|
|
->middleware('ability:admin,settings');
|
|
|
|
|
|
|
|
Route::match(['post', 'put'], 'settings', 'SettingsController@update')
|
|
|
|
->name('settings.update')
|
|
|
|
->middleware('ability:admin,settings');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
|
|
|
// maintenance
|
2020-01-30 22:23:31 +08:00
|
|
|
Route::match(['get'], 'maintenance', 'MaintenanceController@index')
|
|
|
|
->name('maintenance.index')
|
|
|
|
->middleware('ability:admin,maintenance');
|
|
|
|
|
2020-02-11 01:39:59 +08:00
|
|
|
Route::match(['post'], 'maintenance/cache', 'MaintenanceController@cache')
|
2020-01-30 22:23:31 +08:00
|
|
|
->name('maintenance.cache')
|
|
|
|
->middleware('ability:admin,maintenance');
|
2020-02-11 01:39:59 +08:00
|
|
|
|
|
|
|
Route::match(['post'], 'maintenance/update', 'MaintenanceController@update')
|
|
|
|
->name('maintenance.update')
|
|
|
|
->middleware('ability:admin,maintenance');
|
2020-02-11 06:47:46 +08:00
|
|
|
|
|
|
|
Route::match(['post'], 'maintenance/forcecheck', 'MaintenanceController@forcecheck')
|
|
|
|
->name('maintenance.forcecheck')
|
|
|
|
->middleware('ability:admin,maintenance');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
|
|
|
// subfleet
|
2020-01-30 22:23:31 +08:00
|
|
|
Route::get('subfleets/export', 'SubfleetController@export')
|
|
|
|
->name('subfleets.export')
|
|
|
|
->middleware('ability:admin,fleet');
|
|
|
|
|
|
|
|
Route::match(['get', 'post'], 'subfleets/import', 'SubfleetController@import')
|
|
|
|
->name('subfleets.import')
|
|
|
|
->middleware('ability:admin,fleet');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
|
|
|
Route::match(
|
|
|
|
['get', 'post', 'put', 'delete'],
|
|
|
|
'subfleets/{id}/expenses',
|
|
|
|
'SubfleetController@expenses'
|
2020-01-30 22:23:31 +08:00
|
|
|
)->middleware('ability:admin,fleet');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
|
|
|
Route::match(
|
|
|
|
['get', 'post', 'put', 'delete'],
|
|
|
|
'subfleets/{id}/fares',
|
|
|
|
'SubfleetController@fares'
|
2020-01-30 22:23:31 +08:00
|
|
|
)->middleware('ability:admin,fleet');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
|
|
|
Route::match(
|
|
|
|
['get', 'post', 'put', 'delete'],
|
|
|
|
'subfleets/{id}/ranks',
|
|
|
|
'SubfleetController@ranks'
|
2020-01-30 22:23:31 +08:00
|
|
|
)->middleware('ability:admin,fleet');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
2020-01-30 22:23:31 +08:00
|
|
|
Route::resource('subfleets', 'SubfleetController')->middleware('ability:admin,fleet');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
2020-01-30 22:23:31 +08:00
|
|
|
Route::resource('users', 'UserController')->middleware('ability:admin,users');
|
2019-12-25 16:31:09 +08:00
|
|
|
Route::get(
|
|
|
|
'users/{id}/regen_apikey',
|
|
|
|
'UserController@regen_apikey'
|
2020-01-30 22:23:31 +08:00
|
|
|
)->name('users.regen_apikey')->middleware('ability:admin,users');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
|
|
|
// defaults
|
2020-01-30 22:23:31 +08:00
|
|
|
Route::get('', ['uses' => 'DashboardController@index'])
|
|
|
|
->middleware('update_pending', 'ability:admin,admin-access');
|
|
|
|
|
|
|
|
Route::get('/', ['uses' => 'DashboardController@index'])
|
|
|
|
->middleware('update_pending', 'ability:admin,admin-access');
|
|
|
|
|
|
|
|
Route::get('dashboard', ['uses' => 'DashboardController@index', 'name' => 'dashboard'])
|
|
|
|
->middleware('update_pending', 'ability:admin,admin-access');
|
2019-12-25 16:31:09 +08:00
|
|
|
|
|
|
|
Route::match(
|
|
|
|
['get', 'post', 'delete'],
|
|
|
|
'dashboard/news',
|
|
|
|
['uses' => 'DashboardController@news']
|
2020-01-30 22:23:31 +08:00
|
|
|
)->name('dashboard.news')->middleware('update_pending', 'ability:admin,admin-access');
|
2019-12-25 16:31:09 +08:00
|
|
|
}
|
|
|
|
);
|