Clean up routes and middleware checking

This commit is contained in:
Dane Everitt 2016-01-04 16:09:39 -05:00
parent 99a67127c9
commit 4ae8a45ed3
16 changed files with 321 additions and 101 deletions

View file

@ -7,20 +7,60 @@ use Illuminate\Routing\Router;
class ServerRoutes {
public function map(Router $router) {
$router->group(['prefix' => 'server/{server}'], function ($server) use ($router) {
$router->group([
'prefix' => 'server/{server}',
'middleware' => [
'auth',
'server'
]
], function ($server) use ($router) {
// Index View for Server
$router->get('/', [
'as' => 'server.index',
'uses' => 'Server\ServerController@getIndex'
]);
$router->get('/', [ 'as' => 'server.index', 'uses' => 'Server\ServerController@getIndex' ]);
$router->get('/files', [ 'as' => 'files.index', 'uses' => 'Server\ServerController@getFiles' ]);
$router->get('/files/edit/{file}', [ 'as' => 'files.edit', 'uses' => 'Server\ServerController@getEditFile' ])->where('file', '.*');
$router->get('/files/download/{file}', [ 'as' => 'files.download', 'uses' => 'Server\ServerController@getDownloadFile' ])->where('file', '.*');
$router->get('/files/add', [ 'as' => 'files.add', 'uses' => 'Server\ServerController@getAddFile' ]);
// File Manager Routes
$router->get('/files', [
'as' => 'files.index',
'uses' => 'Server\ServerController@getFiles'
]);
// Ajax Routes
$router->get('/files/edit/{file}', [
'as' => 'files.edit',
'uses' => 'Server\ServerController@getEditFile'
])->where('file', '.*');
$router->get('/files/download/{file}', [
'as' => 'files.download',
'uses' => 'Server\ServerController@getDownloadFile'
])->where('file', '.*');
$router->get('/files/add', [
'as' => 'files.add',
'uses' => 'Server\ServerController@getAddFile'
]);
// Assorted AJAX Routes
$router->group(['prefix' => 'ajax'], function ($server) use ($router) {
$router->get('status', [ 'uses' => 'Server\AjaxController@getStatus' ]);
$router->post('set-connection', [ 'uses' => 'Server\AjaxController@postSetConnection' ]);
$router->post('files/directory-list', [ 'uses' => 'Server\AjaxController@postDirectoryList' ]);
$router->post('files/save', [ 'uses' => 'Server\AjaxController@postSaveFile' ]);
// Returns Server Status
$router->get('status', [
'uses' => 'Server\AjaxController@getStatus'
]);
// Sets the Default Connection for the Server
$router->post('set-connection', [
'uses' => 'Server\AjaxController@postSetConnection'
]);
// Assorted File Manager URLs
$router->post('files/directory-list', [
'uses' => 'Server\AjaxController@postDirectoryList'
]);
$router->post('files/save', [
'uses' => 'Server\AjaxController@postSaveFile'
]);
});
});
}