group(['prefix' => 'actions'], function () use ($router) { $router->group(['prefix' => 'businesses'], function () use ($router) { $router->group(['prefix' => '{business}', 'middleware' => 'bindBusiness'], function () use ($router) { $router->get('/info', 'BusinessController@info'); }); }); }); $router->get('/callback', 'CreditController@callback'); $router->get('/{transaction}/redirection', 'CreditController@redirection'); $router->group(['prefix' => 'auth'], function () use ($router) { $router->get('/', 'AuthController@auth')->middleware('auth:api'); $router->delete('/', 'AuthController@delete'); $router->get('/info', 'AuthController@authWithInfo')->middleware('auth:api'); $router->post('login', 'AuthController@login'); $router->post('logout', 'AuthController@logout')->middleware('auth:api'); $router->post('register', 'AuthController@register'); $router->post('revoke/{token}', 'AuthController@revoke'); $router->post('forget-password', 'AuthController@forgetPassword'); $router->post('update-password', 'AuthController@updatePassword'); $router->post('verification', 'AuthController@verification'); $router->get('google/redirect', 'AuthController@redirectToGoogle')->name('google.redirect'); $router->get('google/callback', 'AuthController@handleGoogleCallback')->name('google.callback'); }); $router->group(['prefix' => 'businesses', 'middleware' => 'auth:api'], function () use ($router) { $router->get('/', 'BusinessController@index'); $router->post('/', 'BusinessController@store'); $router->group(['prefix' => '{business}', 'middleware' => 'bindBusiness'], function () use ($router) { $router->get('/tasks', 'TaskController@index'); $router->get('/works', 'WorkController@index'); $router->get('statistics', 'StatisticController@index'); $router->put('/avatar', 'BusinessController@setAvatar'); $router->delete('/avatar', 'BusinessController@unSetAvatar'); $router->get('/', 'BusinessController@show'); $router->put('/', 'BusinessController@update'); $router->delete('/', 'BusinessController@delete'); $router->get('/restore', 'BusinessController@restore'); $router->get('/files', 'FileController@index'); $router->get('/info', 'BusinessController@info'); $router->get('/invoices', 'InvoiceController@index'); $router->get('/invoices/{date}', 'InvoiceController@show'); $router->get('/pay', 'CreditController@pay'); $router->get('/payments', 'CreditController@payments'); $router->group(['prefix' => 'projects'], function () use ($router) { $router->get('/', 'ProjectController@index'); $router->post('/', 'ProjectController@store'); $router->group(['prefix' => '{project}'], function () use ($router) { $router->put('/avatar', 'ProjectController@setAvatar'); $router->delete('/avatar', 'ProjectController@unSetAvatar'); $router->get('/statistics', 'StatisticController@index'); $router->get('/', 'ProjectController@show'); $router->put('/', 'ProjectController@update'); $router->delete('/', 'ProjectController@delete'); $router->group(['prefix' => 'files', 'as' => 'file.', 'middleware' => 'bindBusiness'], function () use ($router) { // $router->get('/', ['as' => 'index', 'uses' => 'FileController@index']); $router->post('/', ['as' => 'store', 'uses' => 'FileController@store']); $router->group(['prefix' => '{file}'], function () use ($router) { $router->get('/', ['as' => 'download', 'uses' => 'FileController@download']); $router->put('/', ['as' => 'rename', 'uses' => 'FileController@rename']); $router->delete('/', ['as' => 'delete', 'uses' => 'FileController@delete']); }); }); $router->get('/restore', 'ProjectController@restore'); $router->group(['prefix' => 'sprints', 'as' => 'sprint.', 'middleware' => 'bindBusiness'], function () use ($router) { $router->get('/', ['as' => 'index', 'uses' => 'SprintController@index']); $router->post('/', ['as' => 'store', 'uses' => 'SprintController@store']); $router->group(['prefix' => '{sprint}'], function () use ($router) { $router->get('/', ['as' => 'show', 'uses' => 'SprintController@show']); $router->put('/', ['as' => 'update', 'uses' => 'SprintController@update']); $router->delete('/', ['as' => 'delete', 'uses' => 'SprintController@delete']); }); }); $router->group(['prefix' => 'systems', 'middleware' => 'bindBusiness'], function () use ($router) { $router->get('/', 'SystemController@index'); $router->post('/', 'SystemController@store'); $router->group(['prefix' => '{system}'], function () use ($router) { $router->get('/', 'SystemController@show'); $router->put('/', 'SystemController@update'); $router->delete('/', 'SystemController@delete'); }); }); $router->group(['prefix' => 'tasks/{task}/files', 'middleware' => 'bindBusiness'], function () use ($router) { $router->get('/', ['uses' => 'TaskFileController@index']); $router->post('/', ['uses' => 'TaskFileController@sync']); $router->get('/{file}', ['uses' => 'TaskFileController@download']); }); $router->group(['prefix' => 'users'], function () use ($router){ $router->post('/', 'ProjectController@storeOrUpdateUser'); $router->group(['prefix' => '{user}'], function () use ($router) { $router->delete('/', 'ProjectController@deleteUser'); }); }); $router->group(['prefix' => 'tasks'], function ($router) { $router->post('/', 'TaskController@store'); $router->group(['prefix' => '{task}'], function ($router) { $router->get('/', 'TaskController@show'); $router->put('/', 'TaskController@update'); $router->delete('/', 'TaskController@destroy'); $router->post('/watchers', 'TaskController@toggleWatcher'); $router->group(['prefix' => 'works'], function ($router) { $router->post('/', 'WorkController@store'); $router->group(['prefix' => '{work}'], function ($router) { $router->get('/', 'WorkController@show'); $router->put('/', 'WorkController@update'); $router->delete('/', 'WorkController@destroy'); }); }); $router->group(['prefix' => 'comments'], function ($router) { $router->get('/', 'CommentController@index'); $router->post('/', 'CommentController@store'); $router->group(['prefix' => '{comment}'], function ($router) { $router->get('/', 'CommentController@show'); $router->put('/', 'CommentController@update'); $router->delete('/', 'CommentController@destroy'); }); }); }); }); }); }); $router->group(['prefix' => 'tags', 'as' => 'tag.', 'middleware' => 'bindBusiness'], function () use ($router) { $router->get('/', ['as' => 'index', 'uses' => 'TagController@index']); $router->post('/', ['as' => 'store', 'uses' => 'TagController@store']); $router->group(['prefix' => '{tag}'], function () use ($router) { $router->get('/', ['as' => 'show', 'uses' => 'TagController@show']); $router->put('/', ['as' => 'update', 'uses' => 'TagController@update']); $router->delete('/', ['as' => 'delete', 'uses' => 'TagController@delete']); }); }); $router->group(['prefix' => 'workflows', 'as' => 'workflow.', 'middleware' => 'bindBusiness'], function () use ($router) { $router->get('/', ['as' => 'index', 'uses' => 'WorkflowController@index']); $router->post('/', ['as' => 'store', 'uses' => 'WorkflowController@store']); $router->group(['prefix' => '{workflow}'], function () use ($router) { $router->get('/', ['as' => 'show', 'uses' => 'WorkflowController@show']); $router->put('/', ['as' => 'update', 'uses' => 'WorkflowController@update']); $router->delete('/', ['as' => 'delete', 'uses' => 'WorkflowController@delete']); $router->group(['prefix' => 'statuses', 'middleware' => 'bindBusiness'], function () use ($router) { $router->get('/', 'StatusController@index'); $router->post('/', 'StatusController@store'); $router->group(['prefix' => '{status}'], function () use ($router) { $router->get('/', 'StatusController@show'); $router->put('/', 'StatusController@update'); $router->delete('/', ['as' => 'delete', 'uses' => 'StatusController@delete']); }); }); }); }); $router->group(['prefix' => 'users'], function () use ($router){ $router->post('/', 'BusinessController@storeOrUpdateUser'); $router->group(['prefix' => '{user}'], function () use ($router) { $router->delete('/', 'BusinessController@deleteUser'); }); }); }); }); $router->group(['prefix' => 'users','middleware' => 'bindBusiness'], function () use ($router) { $router->get('/', 'UserController@index'); $router->get('/search', 'UserController@search'); $router->group(['prefix' => '{user}'], function () use ($router) { $router->get('/', 'UserController@show'); $router->put('/', 'UserController@update'); $router->put('/avatar', 'UserController@setAvatar'); $router->delete('/avatar', 'UserController@unSetAvatar'); }); });