Spatie Laravel Permission Package Tutorial | Using Middleware for permission and role #4
Vložit
- čas přidán 25. 07. 2024
- Laravel Permission package by Spatie
Associate users with roles and permissions
This package allows you to manage user permissions and roles in a database.
Using Middleware for permission and role
Full Python Beginner Playlist: goo.gl/UrcLw4
Become My Patron here goo.gl/NcvDQh
Angular Full 60 Minute Course goo.gl/TL2UFy
To Join Whatsapp, follow this link chat.whatsapp.com/3tZbpzGfrKb...
You can donate any amount via Paypal follow this link goo.gl/JhWsKC
Join Our Slack Community - goo.gl/pqCjZH
--You May Also Like --
Real-Time Chat Series - goo.gl/ri42FD
Git and Github series - goo.gl/BXyPxf
Blog with Admin panel Series - goo.gl/S5JGyt
Laravel Authentication Series: Multi Auth - goo.gl/TyCLlX
Vue Beginner To advanced Series - goo.gl/1bjdGg
Sublime Text Best Package Series - goo.gl/6phTPP
Laravel Ajax Todo Project - goo.gl/p2xTPW
Laravel 5.4 Full Beginner Playlist - goo.gl/zpKzhM
Laravel 5.3 Hindi Beginner Tutorials - goo.gl/Kb3ikd
==================FOLLOW ME ==================
Subscribe for New Releases!
Twitter - / bitfumes
Facebook - / bitfumes
Instagram - / bitfumes
(ask me questions!)
-- QUESTIONS? --
Leave a comment below and I or someone else can help you.
For quick questions you may also want to ask me on Twitter, I respond almost immediately.
Email me support@bitfumes.com
Thanks for all your support!
You are great man, your concept and way of teaching is so good.
YOU SEE THIS GUY, NAMBARR ONE LARAVEL GUY,
i never had good sleep before this package because every system i created, that had custom role management, i never felt the sense of security. because some other guy on youtube poorly described spattie permission package, i avoided using it. but with this i think i'm on the right track to a good night sleep :)
Thankyou so much brother! your doing greate stuff! Keep doing! Love your content! ♥
I'm new to laravel but you helped me so much
Thanks for your love and support, keep learning. Follow bitfumes on twitter.com/bitfumes or facebook.com/Bitfumes to get the latest updates.
bitfumes.com
This serious helped me a lot. Thanks BitFumes. Go Ahead Bro.
Thanks for your love and support, keep learning. Follow bitfumes on twitter.com/bitfumes or facebook.com/Bitfumes to get the latest updates.
Awesome tutorials. .. Im new to laravel but these helped me so much...
Thanks for watching, please like Bitfumes on facebook/twitter to get the latest updates.
Full of this series tutorial are watched by me, Thanks for helpful tutorial !
Thanks for your love and support, keep learning. Subscribe to bitfumes newsletters
bitfumes.com/newsletters
Thanks a lot for the help
I like the way explain this thing.
Awesome great detailed tutorials👌👌
Greaaaat video!
Realy Good tutorials
thanks alot.
Thanks Bro! :D
Awsome great detailed tutorials, but if you can make a tutorial multi auth on Spatie permission package for redirecting users depend on their role, that would be great
thank u so much for this tutorial. 😁
Thanks for watching, Please subscribe to bitfumes' course section. bitfumes.com/courses
Thanks!!
Hi ankur sir you are assigning a role or permission to the routes at web.php.If i don't want to assign middleware to the route as middleware('permission:edit post')?can i assign it another way because if i don't want to assign it manually by typing the 'permission:edit post' i want when a specific routes will call associated roles or permission my logic get??please answer me thanks in advance!
Super Tutorial
thanks man
thanks sir
Gratefully You are supper hero,
Thanks for your love and support, keep learning. Subscribe to bitfumes newsletters
bitfumes.com/newsletters
#Bitfumes, Sir we have added middlewares hard coded. but how we can change them dynamically from front end. Because client have to change role and permission from frontend. Sir plz reply
HI Thanks for the tutorial, but I am struggling to manage users after login to send them different dashboards. How can send the users to different inteterfaces when they login?
there is a middleware called RedirecIfAuthenticated go there and remove < return redirect(RouteServiceProvider::HOME); > then put if conditions on the Auth::user() to check his role/permission in table models_has_roles or Models_has_permissions then redirect the user to the required route name.
Example:
if(Auth::user()->hasRole('writer')) {
return redirect()->route('post.create');
}
elseif(Auth::user()->hasRole('publisher')) {
return redirect()->route('post.posts_waiting_to_publish');
}
But how can you change the view according to the user's role? Because I can occupy the middleware but I always redirect to the HOME view when I log in.
For example:
- admin redirect to the dashboard view.
- Seller redirect to Sales view.
- Viewer redirect to report view.
there is a middleware called RedirecIfAuthenticated go there and remove < return redirect(RouteServiceProvider::HOME); > then put if conditions on the Auth::user() to check his role/permission in table models_has_roles or Models_has_permissions then redirect the user to the required route name.
Example:
if(Auth::user()->hasRole('writer')) {
return redirect()->route('post.create');
}
elseif(Auth::user()->hasRole('publisher')) {
return redirect()->route('post.posts_waiting_to_publish');
}
How to restrict the access to the entire folder contents? For example, we have folder as administrator and folder as user, the user shouldn't have access to all files that are located to administrator (all controllers which are created for admin).
use middleware
with Route::group
But for me permission middleware is not working. 🤨
It may work if no space added between and after while passing argument... But it will good if the Spattie trim string after loop on.
😁😁😁
You are great man, your concept and way of teaching is so good.