-2

In laravel I have declared five different roles like admin,client,employee. I need to restrict user from accessing url based on their roles.

  • declared route like this Route::get('users/{id}/{role}/{path}', ['as' => 'users.showRoleBaseUsers', 'uses' => 'UserController@showRoleBaseUsers']); now need to restrict it based on roles. – Sonali Ghule Oct 10 '19 at 06:17

1 Answers1

0

Create middleware (https://laravel.com/docs/master/middleware#defining-middleware) if roles access then return $next($request); otherwise return redirect('home');

Harshad
  • 326
  • 1
  • 5