Rjonwal
1 month ago
242
7
Laravel

How to set role name in prefix dynamically for same route group in laravel5.8

Posted 1 month ago by Rjonwal

Hello , I want to create dynamic prefix name according to logged user role name like for a same route group if admin is login in admin panel then url like http://localhost:8000/admin/dashboard and if dealer is login in admin panel http://localhost:8000/dealer/dashboard

my route group is

Route::group(['prefix' => 'admin', 'as' => 'admin.', 'namespace' => 'Admin', 'middleware' => ['auth', 'verified', 'preventBackHistory']], function () { Route::get('/dashboard', '[email protected]')->name('home'); });

Basically My route group is same for admin & dealer when i want different prefix according to user role when user is successfully login

Please sign in or create an account to participate in this conversation.