Convert route options to fluent methods

Laravel 8 adopts the tuple syntax for controller actions. Since the old options array is incompatible with this syntax, Shift converted them to use modern, fluent methods.
This commit is contained in:
Shift
2023-01-07 20:33:08 +00:00
parent 2e6e296715
commit 41cb65c70c
6 changed files with 357 additions and 447 deletions

View File

@@ -8,15 +8,15 @@
* @author Vijay Sebastian<vijay.sebastian@ladybirdweb.com>
* @name Faveo
*/
Route::group(['prefix' => 'api/v1'], function () {
Route::prefix('api/v1')->group(function () {
Route::post('authenticate', '\App\Api\v1\TokenAuthController@authenticate');
Route::get('authenticate/user', '\App\Api\v1\TokenAuthController@getAuthenticatedUser');
Route::get('/database-config', ['as' => 'database-config', 'uses' => '\App\Api\v1\InstallerApiController@config_database']);
Route::get('/system-config', ['as' => 'database-config', 'uses' => '\App\Api\v1\InstallerApiController@config_system']);
Route::get('/database-config', '\App\Api\v1\InstallerApiController@config_database')->name('database-config');
Route::get('/system-config', '\App\Api\v1\InstallerApiController@config_system')->name('database-config');
/*
* Helpdesk
*/
Route::group(['prefix' => 'helpdesk'], function () {
Route::prefix('helpdesk')->group(function () {
Route::post('create', '\App\Api\v1\ApiController@createTicket');
Route::post('reply', '\App\Api\v1\ApiController@ticketReply');
Route::post('edit', '\App\Api\v1\ApiController@editTicket');
@@ -60,7 +60,7 @@
/*
* FCM token response
*/
Route::post('fcmtoken', ['as' => 'fcmtoken', 'uses' => 'Common\PushNotificationController@fcmToken']);
Route::post('fcmtoken', 'Common\PushNotificationController@fcmToken')->name('fcmtoken');
});
/*
* ================================================================================================
@@ -70,11 +70,11 @@
* @author Manish Verma<manish.verma@ladybirdweb.com>
* @name Faveo
*/
Route::group(['prefix' => 'api/v2'], function () {
Route::prefix('api/v2')->group(function () {
/*
* Helpdesk
*/
Route::group(['prefix' => 'helpdesk'], function () {
Route::prefix('helpdesk')->group(function () {
Route::get('tickets', '\App\Api\v2\TicketController@getTickets');
});
});

View File

@@ -4,6 +4,6 @@ Breadcrumbs::register('logs', function ($breadcrumbs) {
$breadcrumbs->parent('setting');
$breadcrumbs->push('System Logs', route('logs'));
});
Route::group(['middleware' => ['web', 'auth', 'roles']], function () {
Route::get('logs', ['as' => 'logs', 'uses' => 'App\FaveoLog\controllers\LogViewerController@index']);
Route::middleware('web', 'auth', 'roles')->group(function () {
Route::get('logs', 'App\FaveoLog\controllers\LogViewerController@index')->name('logs');
});

View File

@@ -5,8 +5,8 @@
echo $controller->settingsIcon();
});
Route::group(['middleware' => ['web']], function () {
Route::get('storage', ['as' => 'storage', 'uses' => 'App\FaveoStorage\Controllers\SettingsController@settings']);
Route::post('storage', ['as' => 'post.storage', 'uses' => 'App\FaveoStorage\Controllers\SettingsController@postSettings']);
Route::get('attachment', ['as' => 'attach', 'uses' => 'App\FaveoStorage\Controllers\SettingsController@attachment']);
Route::middleware('web')->group(function () {
Route::get('storage', 'App\FaveoStorage\Controllers\SettingsController@settings')->name('storage');
Route::post('storage', 'App\FaveoStorage\Controllers\SettingsController@postSettings')->name('post.storage');
Route::get('attachment', 'App\FaveoStorage\Controllers\SettingsController@attachment')->name('attach');
});

View File

@@ -55,10 +55,7 @@ class RouteServiceProvider extends ServiceProvider
*/
protected function mapWebRoutes()
{
Route::group([
'middleware' => 'web',
'namespace' => $this->namespace,
], function ($router) {
Route::middleware('web')->namespace($this->namespace)->group(function ($router) {
require base_path('routes/web.php');
});
}
@@ -72,11 +69,7 @@ class RouteServiceProvider extends ServiceProvider
*/
protected function mapApiRoutes()
{
Route::group([
'middleware' => 'api',
'namespace' => $this->namespace,
'prefix' => 'api',
], function ($router) {
Route::middleware('api')->namespace($this->namespace)->prefix('api')->group(function ($router) {
require base_path('routes/api.php');
});
}
@@ -90,10 +83,7 @@ class RouteServiceProvider extends ServiceProvider
*/
protected function mapInstallerRoutes()
{
Route::group([
'middleware' => ['web', 'installer'],
'namespace' => $this->namespace,
], function ($router) {
Route::middleware('web', 'installer')->namespace($this->namespace)->group(function ($router) {
require base_path('routes/installer.php');
});
}
@@ -107,11 +97,7 @@ class RouteServiceProvider extends ServiceProvider
*/
protected function mapUpdateRoutes()
{
Route::group([
'middleware' => ['web', 'redirect', 'install'],
'namespace' => $this->namespace,
'prefix' => 'app/update',
], function ($router) {
Route::middleware('web', 'redirect', 'install')->namespace($this->namespace)->prefix('app/update')->group(function ($router) {
require base_path('routes/update.php');
});
}