Laravel roles on routes -


i have laravel 5.2 application using auth functionality provided laravel. roles , permissions i'm using laravel-permission. have defined 3 roles: admin, seller, buyer.

i looking solution able specify role per route. have group of routes accessible user role 'admin', group of routes accessible user role 'seller' , group of routes accessible users role 'buyer'.

i thinking define separate middleware admin, buyer , seller , use routes. or better way define 1 middleware 'roles' differentiates between roles? better ways?

you can make middleware takes parameters. can like

'middleware' => 'role:role_name', 

a single middleware params passed should fine


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo