From 559347ea1cedf0af3e2f0f2feb041d2fd168b96a Mon Sep 17 00:00:00 2001 From: Shivendra Date: Mon, 22 Jul 2024 13:08:41 +0530 Subject: [PATCH] refactor-type-routes --- packages/Webkul/Admin/src/Http/routes.php | 12 --------- .../src/Providers/AdminServiceProvider.php | 3 +++ .../Admin/src/Routes/settings-routes.php | 26 +++++++++++++++++++ packages/Webkul/Admin/src/Routes/web.php | 7 +++++ 4 files changed, 36 insertions(+), 12 deletions(-) create mode 100644 packages/Webkul/Admin/src/Routes/settings-routes.php create mode 100644 packages/Webkul/Admin/src/Routes/web.php diff --git a/packages/Webkul/Admin/src/Http/routes.php b/packages/Webkul/Admin/src/Http/routes.php index 9fb07b6cc..2dd12473a 100644 --- a/packages/Webkul/Admin/src/Http/routes.php +++ b/packages/Webkul/Admin/src/Http/routes.php @@ -352,18 +352,6 @@ Route::delete('{id}', 'SourceController@destroy')->name('admin.settings.sources.delete'); }); - // Lead Types Routes - Route::prefix('types')->group(function () { - Route::get('', 'TypeController@index')->name('admin.settings.types.index'); - - Route::post('create', 'TypeController@store')->name('admin.settings.types.store'); - - Route::get('edit/{id?}', 'TypeController@edit')->name('admin.settings.types.edit'); - - Route::put('edit/{id}', 'TypeController@update')->name('admin.settings.types.update'); - - Route::delete('{id}', 'TypeController@destroy')->name('admin.settings.types.delete'); - }); // Email Templates Routes Route::prefix('email-templates')->group(function () { diff --git a/packages/Webkul/Admin/src/Providers/AdminServiceProvider.php b/packages/Webkul/Admin/src/Providers/AdminServiceProvider.php index cb35a63ef..9d2f37768 100644 --- a/packages/Webkul/Admin/src/Providers/AdminServiceProvider.php +++ b/packages/Webkul/Admin/src/Providers/AdminServiceProvider.php @@ -8,6 +8,7 @@ use Illuminate\Support\Facades\Blade; use Illuminate\Support\ServiceProvider; use Webkul\Admin\Http\Middleware\Locale; +use Illuminate\Support\Facades\Route; class AdminServiceProvider extends ServiceProvider { @@ -18,6 +19,8 @@ public function boot(Router $router): void { include __DIR__.'/../Http/helpers.php'; + Route::middleware('web')->group(__DIR__.'/../Routes/web.php'); + $this->loadRoutesFrom(__DIR__.'/../Http/routes.php'); $this->loadMigrationsFrom(__DIR__.'/../Database/Migrations'); diff --git a/packages/Webkul/Admin/src/Routes/settings-routes.php b/packages/Webkul/Admin/src/Routes/settings-routes.php new file mode 100644 index 000000000..a0665951c --- /dev/null +++ b/packages/Webkul/Admin/src/Routes/settings-routes.php @@ -0,0 +1,26 @@ + ['admin_locale'], 'prefix' => config('app.admin_path')], function () { + Route::prefix('settings')->group(function () { + /** + * Type routes. + */ + Route::controller(TypeController::class)->prefix('types')->group(function () { + Route::get('', 'index')->name('admin.settings.types.index'); + + Route::post('create', 'store')->name('admin.settings.types.store'); + + Route::get('edit/{id?}', 'edit')->name('admin.settings.types.edit'); + + Route::put('edit/{id}', 'update')->name('admin.settings.types.update'); + + Route::delete('{id}', 'destroy')->name('admin.settings.types.delete'); + }); + }); +}); diff --git a/packages/Webkul/Admin/src/Routes/web.php b/packages/Webkul/Admin/src/Routes/web.php new file mode 100644 index 000000000..62409428e --- /dev/null +++ b/packages/Webkul/Admin/src/Routes/web.php @@ -0,0 +1,7 @@ +