Laravel Roles and Permissions: All CORE Things You Need To Know

  Рет қаралды 224,372

Laravel Daily

Laravel Daily

Күн бұрын

Пікірлер: 256
@LostInAutism
@LostInAutism 2 жыл бұрын
0:50 - 1st Example: Separate views 5:20 - 2nd Example: Gates with static roles and permissions 8:25 - 3rd Example: Policies Don't mind me, I find myself on this video often.
@amine_fadssi
@amine_fadssi 2 жыл бұрын
thanks
@fahvygaming1118
@fahvygaming1118 2 жыл бұрын
third time I'm rewatching this also
@vasiovasio
@vasiovasio Жыл бұрын
Thank man! I wish you in some parallel Universe Miss Brazil to be your girlfriend! 👍
@merdmann
@merdmann 2 жыл бұрын
Videos like these give me hope. Reading through the docs is one thing but seeing a practical way of using it is another. You and Code with Dary are the best channels to learn laravel
@AslamD
@AslamD 3 жыл бұрын
This is definitely most asked question on Laravel community. Thank You :)
@raj-kal
@raj-kal 2 жыл бұрын
I have learned lots of advanced Laravel topics from your tutorials. I almost watched all of your videos. thanks
@SRG-Learn-Code
@SRG-Learn-Code 3 жыл бұрын
Not often you find videos regarding concepts without implementations, very cool. I didn't want to follow a tutorial about integrating any of this systems without knowing what each can do so thanks for sharing this type of videos.
@allen86333
@allen86333 2 жыл бұрын
I can't thank you enough. I'm a beginner , Your suggestions,tips helped me grow so fast. My codes are better than before , my understanding has increased. You have boosted and cleared my confusions like so easy with every practical examples. I have completed Advance Beginner path within 4 months from since I installed Laravel on my pc, done some small solo projects for practice. I'm about to join as a Jr. Software Engineer. Soon gonna join your paid courses. Thank You so much . and also I hate X-slot in breeze :) but you made my day with that explanation video how you reverse engineered it , i tried it myself but I couldn't finish it because of some terms that i was unclear.
@8infinito8
@8infinito8 8 ай бұрын
Every now and again I view your videos to check my knowledge in Laravel or to better understand some concepts and you always are a guarantee! Through the years I became a better Laravel developer thanks to your videos. You're a great teacher and developer. Cheers from Italy ❤
@alnahian2003
@alnahian2003 2 жыл бұрын
Got stuck at authorization part of the documentation. this video really helped me out!
@ndeblauw
@ndeblauw 3 жыл бұрын
Excellent overview, perfect tempo, great (pedagogic) approach. Thanks again for your continued efforts!
@nisargsachinsaple
@nisargsachinsaple 3 жыл бұрын
Thank You soo much sir.., Now i can easily crack my interview without any hurdles. I will continue watching your daily videos to master laravel 👍
@AMD-1087
@AMD-1087 3 жыл бұрын
This was really helpful. I just wanted to mention that Laravel Policies would work only on an authenticated route.
@SergeyNeskhodovskiy
@SergeyNeskhodovskiy 3 жыл бұрын
Good catch, only a few days ago I scratched my head wondering why Gate::check always returned false, when the logic inside the gate was definitely permissive. I figured out that you had to be authenticated in order to even reach that logic.
@mabdullahsari
@mabdullahsari 3 жыл бұрын
No, this is false. You have to typehint the first argument as a nullable user if you want unauthenticated routes to also make use of it.
@rejowanahmed6819
@rejowanahmed6819 Жыл бұрын
Why'd someone even want to use policies with unauthenticated users? 😐 There are middlewares for that
@asifm3520
@asifm3520 3 жыл бұрын
One of best explanation from your arsenal. Also liked slow pace while explaining every minute details.
@LaravelDaily
@LaravelDaily 2 жыл бұрын
Liked this video? I have many more: subscribe to my 30+ Laravel courses laraveldaily.com/courses
@gmstabloid
@gmstabloid 2 жыл бұрын
What does it take to become as fluent as you are in Laravel? What was your path to learning at this level? Please advise!
@syofyanzuhad
@syofyanzuhad 3 жыл бұрын
Great 🔥🔥 Yesterday, i just searching bout this topic on your channel sir.. 😅 And now i have a notice to watch this video.. 👍👍👍
@hichemtaboukouyout2958
@hichemtaboukouyout2958 2 ай бұрын
Hello, such a nice explanation, just one thing I know and I'm sure many Laravel programmers wonder, is when to use authorization in gates/policies and when to use middlewares, like if we have a middleware, why call $this->authorize in the controller? actually why are there 2 methods in the first place, when to use what? please make a short video about this because I'm telling you, many Laravel users fall into this question, I know yes in small projects this detail may not be important, but the bigger the project I think these details can have a significant impact on best practices that allow scalability. Thanks
@ChangeYourLifeForever
@ChangeYourLifeForever Жыл бұрын
thank you i finished first level and now i am on the second level on the path learning on your website
@SeyedSadeghAtaii
@SeyedSadeghAtaii 3 жыл бұрын
Loving the videos, they've been a huge help to me and you've got a no nonsense approach to teaching that's appreciated for sure 👍🏻
@freshlybakedkamote8047
@freshlybakedkamote8047 2 жыл бұрын
You saved me with this policies approach. I can't get the AuthServiceProvider working and didn't know that I had to use $this->authorize. Thanks a lot
@hassamulhaq7762
@hassamulhaq7762 3 жыл бұрын
Superb video! I watched 5 mint duration and continue watching. Separate controller for User and Admin, Middleware and route structure all concept is informative. I am working on a project based on Online Exhibitions where we have Admin, User, Organizer, Exhibitor, Speaker, and visitor roles while watching this video I'm summarizing the future plan about project structure. Thank you Povilas Sir.
@sraboniakhter6653
@sraboniakhter6653 3 жыл бұрын
Each of your video means a piece of diamond to me 😊 Take love from Bangladesh ❤❤❤
@julio0olive
@julio0olive Жыл бұрын
WTF! You explained very well compare with any video that I saw, probably I'll take a few curses from your site. Cheers from Mexico
@stefanusj_
@stefanusj_ 3 жыл бұрын
last one about laravel policy is so cool, I really like that, thanks for the video
@galangaidil9421
@galangaidil9421 2 жыл бұрын
Perfect explanation about authorization in laravel. Thank you.
@JellyLancelot
@JellyLancelot 3 жыл бұрын
Perfect timing, this is a brilliant simple walkthrough/example use case
@mahmoud-bakheet
@mahmoud-bakheet Жыл бұрын
after 2 years still useful ❤
@DanialRanjbar-u7t
@DanialRanjbar-u7t Жыл бұрын
You don't get enough credit for your wonderful videos. thanks
@khizer3528
@khizer3528 3 жыл бұрын
One of the simplest way to explain this topic ❤️
@VadimBesedin
@VadimBesedin 5 ай бұрын
You can also use Gates in 'can' middleware: Route::get('/admin', function () { // Code to be executed if the user has the 'create-tasks' permission })->middleware('can:create-tasks');
@abuhurairah7042
@abuhurairah7042 3 жыл бұрын
Your explanations are really comprehensive, I'm really glad that I watched this, thanks!
@Shuvooa
@Shuvooa Жыл бұрын
You are single handedly responsible for saving PHP from dying.
@digvijaychauhan2000
@digvijaychauhan2000 3 жыл бұрын
Good info. In addition, one can also use request rules in the controller.
@daniyarislamgaliyev8627
@daniyarislamgaliyev8627 3 жыл бұрын
S - single responsibility. Request rules are responsible for just validating parameters, and they should not resolve roles, permissions etc.
@bboydarknesz
@bboydarknesz 3 жыл бұрын
This is the best best best explanation I found. Very very thanks
@JouvaMoufette
@JouvaMoufette 3 жыл бұрын
Policies are one of my favorite features of Laravel. I was never sure if I should use gates instead, but I do like the grouping, so yeah I'll continue to use policies. Also, you shouldn't use auth() in the policy because you already have $user
@LaravelDaily
@LaravelDaily 3 жыл бұрын
Yes, good point about auth()
@reikosama1
@reikosama1 3 жыл бұрын
Also, if you are using auth middleware to protect the routes, it is guaranteed that the user is logged in
@JouvaMoufette
@JouvaMoufette 3 жыл бұрын
@@reikosama1 Yeah but that would only mean you don't have to check the $user being null. You'd still want to check against IDs if appropriate (e.g. Editing records owned by someone)
@techwan7
@techwan7 3 жыл бұрын
All I want to say is thank you so much! Finally! Very helpful.
@Shagrath86
@Shagrath86 2 жыл бұрын
Your channel is making me wants to switch to Laravel :)
@syedshariqueahmed9039
@syedshariqueahmed9039 2 жыл бұрын
You are amazing!! God bless u sir for helping and explaining these amazing features.
@Babaknouri
@Babaknouri Жыл бұрын
Thanks a lot for your great examples, I've struggled a lot with these concepts, but now, it is very clear to me.
@Scorpion_13131
@Scorpion_13131 3 жыл бұрын
Couldn't be explained better than this! Thank you so much
@Ajcmaster
@Ajcmaster 2 жыл бұрын
Congratz on the channel, it is one of the best I found about Laravel. I thought about asking how you deal with business related validation rules. In one of my projects, I develop a platform where you can advertise your real estate properties. Basically, you choose a plan that has a membership fee and a monthly fee. Apart from that, you optionally buy other services together with the plan . For now, you can only hire one plan per order. So, the order model is basically {id, plan_id, property_id, ...} and then there is a pivot table to link service items. Thing is, there is a requirement to allow the user to delete an order only if the order is either just created and not yet paid or the payment has failed, and similarly to only delete a property if it has no open orders. Where would you put this validation?
@Ajcmaster
@Ajcmaster 2 жыл бұрын
There are other examples, like you can only schedule a visit to the property for at least X hours from now.
@hassanfazeel2354
@hassanfazeel2354 3 жыл бұрын
Great video..need to watch couple of times to understand fully. Thanks a lot
@mhailingsworth
@mhailingsworth Жыл бұрын
Your videos are really a great help - thank you so much 👍🏻
@WOoooow_007
@WOoooow_007 2 жыл бұрын
Very Helpful, thanks, brother.
@oussamachanii3480
@oussamachanii3480 3 жыл бұрын
we can use polymorph on users table with the different user's types and create a table on every user type to associate that with the 'useable' morph field
@ShailendraSharmaDark
@ShailendraSharmaDark 3 жыл бұрын
I've used Laravel spatie role permission package to handle role based authentication and authorisation in my laravel map
@Lipe007_br
@Lipe007_br 3 жыл бұрын
It was exactly what I was looking for, your videos are so cool and helped me alot, best regards.
@richardalain2988
@richardalain2988 3 жыл бұрын
Very clear explanation. You are a great mentor! Keep up your great work !
@taslimsuman
@taslimsuman 3 жыл бұрын
Thank you very much. I never use policy before but now I can.
@stalinwesley
@stalinwesley Жыл бұрын
Thank you Mr. Povilas,
@m.faisalsultan2463
@m.faisalsultan2463 3 жыл бұрын
wow... i was looking for this kind of tutorials.. great explanation and very helpful... Thank you sir.
@isururanawaka5839
@isururanawaka5839 3 жыл бұрын
Thank you sir. Very clear explaination on everything related.
@fsiradio
@fsiradio 3 жыл бұрын
Very helpful, the best I've seen so far.
@gssj-o8p
@gssj-o8p Жыл бұрын
Thank you very much, my controller was a mess validating all this stuff without any technique! What you think about creating a RoleEnum instead of consts inside the model?
@EnsYlmaz51
@EnsYlmaz51 Жыл бұрын
Very well explained. Exactly what I was looking for
@grayos14
@grayos14 2 жыл бұрын
really good explanations, thank you so much
@abdulqadir9348
@abdulqadir9348 3 жыл бұрын
Hi, What is the best solution for multiple authentication in laravel ? Using multiple table with guard eg default users table for frontend users and admins table for backend users (Note: in backend there is users with role.) Adding is_admin field in default users table. And add the middleware for admin or user. Please suggest.
@dudezkie
@dudezkie 2 жыл бұрын
I like how explain it and really clean, can you do this in database driven permissions and roles?
@angeloabritaa
@angeloabritaa 3 жыл бұрын
Good tutorial! thanks from Brazil!
@L-A-O-S
@L-A-O-S 3 жыл бұрын
Good, i will use it. But in role model, some kind of bad naming maybe in constants, when you use IS_ it says that is boolean. Maybe Role::Admin more better
@LaravelDaily
@LaravelDaily 3 жыл бұрын
Good catch, probably you're right.
@abdelbarimessaoud242
@abdelbarimessaoud242 3 жыл бұрын
LOVE the video! thanks for doing all this work really appreciate everything you do.
@liteninkiran
@liteninkiran 3 жыл бұрын
Hi. Really love this video. Very helpful. Thank you.
@sunnysk43
@sunnysk43 3 жыл бұрын
Amazing as always! Very helpful. Thank you so much! Keep up the good work.
@MrDhump
@MrDhump 3 жыл бұрын
Love his explanations. I was looking for permissions in laravel & just found this amazing video.
@ShailendraSharmaDark
@ShailendraSharmaDark 3 жыл бұрын
use the spatie role permission package available in laravel
@davidsonzed
@davidsonzed 3 жыл бұрын
Very interesting video, I sometimes wonder why not Taylor make a little modification to default users table and add 'is_admin' field by default, because now this has become a very popular question and a request. Can you make a details videos on how to use 'Gates & Policy'. 🔥🔥 Thank you very much for all the free videos.
@LaravelDaily
@LaravelDaily 3 жыл бұрын
Not sure what else can I add about gates and policy :)
@davidsonzed
@davidsonzed 3 жыл бұрын
@@LaravelDaily what I means was to create a detailed video instead showing a short instruction on a code that you already have written.
@LaravelDaily
@LaravelDaily 3 жыл бұрын
I don't think that repeating the same information in a slower and longer way would be very useful, to be honest.
@ah-rasel
@ah-rasel 3 жыл бұрын
Thank you Mr. Povilas, Exactly for what I was going to email you 😍. Take love for this amazing job. ❤️
@pekkanikolaus
@pekkanikolaus 2 жыл бұрын
This is incredibly helpful. Thank you.
@adilizm704
@adilizm704 3 жыл бұрын
you are the best looks simple and practic i love your vids
@keithroye2459
@keithroye2459 3 жыл бұрын
Beautiful explanation
@muhammadshoaib1034
@muhammadshoaib1034 3 жыл бұрын
it's amazing and perfect but how we can manage for dynamic roles according to menus. To store roles and permissions in database.
@droneggin
@droneggin 2 жыл бұрын
Thanks a lot for helpful videos. I have a question. We have implemented LDAP record package, and our company employees can log in into system using their domain credentials without registration. How I can add Spatie roles and permissions for those users with keeping LDAP login mechanism? Is it possible?
@steveowago1089
@steveowago1089 2 жыл бұрын
Nice video, Quick question...Is it possible to assign abilities dynamically from Database records using Gates, assigned to the Auth::id();?
@inso4606
@inso4606 3 жыл бұрын
Another great video! I have not been watching Policy course yet, but I think here (in tube), I can suggest something to part 2 (Gates): In my projects, I group gates by roles and actions - i.e. gate for admin, gate for manager (and admin), gate for author (admin and author) and just using separte route files. In every one route file - group routes by middleware. I.e. for admin gate (Gate::define('admin' ..)) - route file will be web-admin.php and in the file - Route::group(['middleware' => ['can:admin']], fn...). In this way is not necessary to add authorize line in each method. I don't know - is this right or not, but think is more visible and escaped the point if we forget about authorize line. Thank You for all of Your videos! Thank You and for your courses! They are so usefull even for advanced laravel developer!
@LaravelDaily
@LaravelDaily 3 жыл бұрын
Yes, structuring routes by separate files and separate gates is another good way to structure it, thanks for valuable comment.
@gurpbiedurpbiedurp8811
@gurpbiedurpbiedurp8811 3 жыл бұрын
Interesting way of checking the permissions. I check my premissions inside the construct and use the default permissions middleware: function __construct() { $this->middleware('permission:vacancy-list|vacancy-create|vacancy-edit|vacancy-delete', ['only' => ['index', 'show']]); $this->middleware('permission:vacancy-create', ['only' => ['create', 'store']]); $this->middleware('permission:vacancy-edit', ['only' => ['edit', 'update']]); $this->middleware('permission:vacancy-delete', ['only' => ['destroy']]); }
@LaravelDaily
@LaravelDaily 3 жыл бұрын
That is also a valid way, but I think it's more readable to have permissions set at every method, then you don't need to scroll to the constructor to find out who has access to this method.
@gurpbiedurpbiedurp8811
@gurpbiedurpbiedurp8811 3 жыл бұрын
@@LaravelDaily fair point!
@JoaoPereira-ot8ik
@JoaoPereira-ot8ik 3 жыл бұрын
At 10:00, in TaskController at the public function store, is it mandatory to have the part of Task::create($request ...) or can we have a $this->validate function?
@reubenarinze4490
@reubenarinze4490 3 жыл бұрын
Thank you for a clear explanation
@magmaticly
@magmaticly 3 жыл бұрын
This is exactly what I was looking for. Thanks.
@nishanUSA
@nishanUSA 3 жыл бұрын
Amazing concept Povilas. Laravel guard would also best for future videos.
@LaravelDaily
@LaravelDaily 3 жыл бұрын
I haven't really used guards in last couple of years, I always use roles/permissions instead.
@Gabriel-iz4kp
@Gabriel-iz4kp 2 жыл бұрын
@LaravelDaily Thanks for all those great Videos. I've got a question regarding this topic thinking a bit over the top about separating Frontend and Admin/Backend. How would you do Kernel.php separation if one wants to separate these bootstraps f.e. using different components and so on? So likely I don't even want the frontend Kernel.php to include stuff that I really only want to have in Admin/Backend part? Pre-Spoiler... I already had some success on that delegating from the generic Kernel.php to an extended Backend/Kernel and Frontend/Kernel by using Route-Group as separator ("/" and "/admin"). But there's still one caveat when trying f.e. to enable the debug-toolbar which somehow doesn't inject anymore as it looks like somehow it's trying to do that on level of the original Kernel and not the final Kernel processing the bootstrap afterwards. I'm curious about your feedback and/or a video about that or which else way you would suppose to do this in a clean way?!
@denizebassifigueiredo3706
@denizebassifigueiredo3706 2 жыл бұрын
Thanks for the video! great help!
@flyhigh6660
@flyhigh6660 3 жыл бұрын
For relational tables, do you prefer [user, user_tasks], or [user, tasks] ? At Laravel 5, i saw many people reference the relational table name with underscore, but in your newer videos, your models and tables have one own name.
@LaravelDaily
@LaravelDaily 3 жыл бұрын
Depends on the exact situations.
@flyhigh6660
@flyhigh6660 3 жыл бұрын
@@LaravelDaily Only for One To Many Relations, I'm building a Cryptocurrency App, so there is a Token and a Token has on Token-Platform, currently my Models named [Token, TokenPlatform, TokenQuote]. But you confuse me now, and i overthink to rename that to [Token, Platform, Quote]
@yasirmazin4561
@yasirmazin4561 3 жыл бұрын
Hi, Does the course including the middle-where ? Ex: linking the the user with one/ or more than one location ( asset ). Thanks
@leonvanrijswijk8409
@leonvanrijswijk8409 3 жыл бұрын
Thanks for this good overview
@ruwanbandara140
@ruwanbandara140 3 жыл бұрын
Thank you so much for this video. Please make a video about how to integrate firebase (with firebase SDK) with Laravel 8 and how to save user data into the local database after user account verification using firebase.
@LaravelDaily
@LaravelDaily 3 жыл бұрын
Haven't worked with firebase recently so can't make a video about it
@ruwanbandara140
@ruwanbandara140 3 жыл бұрын
@@LaravelDaily No worries sir. Thank you so much for reply.
@sandeepdcte
@sandeepdcte 3 жыл бұрын
Is it possible to manage user,admin, roles , permissions from back end using single user table...Without creating any guard...And of course differentiate using prefix admin
@josuebarros-desenvolvedorw2490
@josuebarros-desenvolvedorw2490 3 жыл бұрын
This is a wonderful way to implement Roles/Permissions, thanks a lot!!! But how can I create a SEPARATE admin/user dashboard with different TABLES??? Ex: Users in a table, Admins in another, Managers in another table...
@LaravelDaily
@LaravelDaily 3 жыл бұрын
Why would you want to do that? It makes things so complicated, then.
@josuebarros-desenvolvedorw2490
@josuebarros-desenvolvedorw2490 3 жыл бұрын
@@LaravelDaily I was thinking about that because my client wants a real estate with a admin area, and want to let normal users signing up themselves, do you think its fine keeping the same table for both? wont it give performance problems in future?
@LaravelDaily
@LaravelDaily 3 жыл бұрын
I haven't encountered performance problems with this. Unless you have 50+ columns in that users table, but even then, it depends on your queries in the future.
@josuebarros-desenvolvedorw2490
@josuebarros-desenvolvedorw2490 3 жыл бұрын
@@LaravelDaily thanks a lot friend!!! to have a NuxtJS spa with Nuxt-Auth, do I need to create the roles the same way?
@martinjones8231
@martinjones8231 3 жыл бұрын
Sir can u make a complete video that will include validation, role permission of each User with an admin.
@markcorrigan293
@markcorrigan293 2 жыл бұрын
Hi. Can I ask you to do a video turorial on how to use bouncer. If you can demo it using the crud and admin / user viewing and not viewing buttons that will be great.
@VadimBesedin
@VadimBesedin Жыл бұрын
@13:31 You can also have a 'role' column in your 'users' table, that will contain names of the roles 'admin', 'manager', 'user', etc. And check for them - clean and clear. And if you worried about consistency of those role names in the forms, you can put them in User model as constants. Pros: clear role names in the code, no additional table and queries required. Cons: to add additional roles you will need to add them in the User model class. Or just be mindful what you assign as a role. If there any other Pros and Cons - please list them here.
@modestasmv
@modestasmv Жыл бұрын
Hey, the biggest con of your approach is the limitation on how many roles you can assign to the person at that point. For example, with the package, you can easily add multiple roles to the person (which sometimes is necessary), and when using a single column - you are stuck with one :)
@VadimBesedin
@VadimBesedin Жыл бұрын
@@modestasmv In case when user should have many roles - yea, agree - pivot table and roles table will be the way to go. But, is there any cons if there is no need for multiple roles per user?
@modestasmv
@modestasmv Жыл бұрын
@@VadimBesedin In my experience - there's quite a good chance that your application will need some sort of multi role or permissions eventually. Of course that might not be the case but having an additional query to actually get the role - isn't that impactful and you can actually employ caching for this :)
@VadimBesedin
@VadimBesedin Жыл бұрын
@@modestasmv I see your opinion. But you've missed the question regarding any other cons, except the one you've already mentioned. So, looks like there is no cons if multi-role is not required.
@ducielsolutions1290
@ducielsolutions1290 2 жыл бұрын
If i could suscribe a thousand times i would do it for sure... Thank you very much
@career248
@career248 Жыл бұрын
Awesome, thanks!
@angelp11
@angelp11 3 жыл бұрын
what do you think about Spatie ? And.. If you have to choose between Spatie or [Middelware, Gate, Policy]'s Laravel natvie, what do you choose?
@LaravelDaily
@LaravelDaily 3 жыл бұрын
I have this video about their package: kzbin.info/www/bejne/hJi3oJxmqs6AhLM It's a personal preference what you're more comfortable with. I would choose our own QuickAdminPanel.com system because I have a lot of practice with it.
@zakiarahmoune7458
@zakiarahmoune7458 2 жыл бұрын
Very useful ... i appreciate it .. thank you Sir!
@elvissam1401
@elvissam1401 3 жыл бұрын
This video is really good!
@EduardoMarinhodosSantos
@EduardoMarinhodosSantos 9 ай бұрын
What a GREAT video
@ozgenx7249
@ozgenx7249 3 жыл бұрын
Thank you for the video. Out of interest sake, why would it be a bad idea to have one controller for both admin and user by creating two variables in the controller, one selecting all tasks and the other selecting only user tasks and then in the view choose which data to display depending on whether logged in user isadmin or not? Thank you to those who can assist
@martinhansen3673
@martinhansen3673 2 жыл бұрын
That would not be a bad idea. If your UI design is the same, then you would make use of the DRY-concept like this. It depends on your needs for the project. I like the concept of separating things, but some times it would be conflicting with DRY.
@Lakmalniranga
@Lakmalniranga 3 жыл бұрын
As always a great one. Thanks!
@mohammadkhazaee9730
@mohammadkhazaee9730 3 жыл бұрын
fan of laravel-permission
@MrDragos360
@MrDragos360 3 жыл бұрын
When would you recomend the use of a package like Bouncer or Spatie Laravel-permission over a simple implementation like you showed in this video ? I tried all of them and I can say that Bouncer feels the best. Spatie has that problems with multiple guards and in most web apps there are at least 2 guards: web and api, so it requires a duplicate of everything. Also for me the "native roles and permisions" seems ok for small apps that don't have many roles and permisions. Something more, what about using those roles and permisions in a SPA based on VUE, React, Angular, etc that has Laravel as backend API ? What data should be sent to the SPA in order to handle some "guards"(routes guards, only show what a user is allowed too see, etc) ? Sure, the backend protections must be implemented but they are similar an web app. As of now I am implementing Bouncer and I plan to send the user role name and his abilities list. Then I'll check to see if his abilities list contains the ability that is needed to access an area or do do an action. How it sounds ? (My app has 7 roles and over 20 abilities in total). Thanks!
@LaravelDaily
@LaravelDaily 3 жыл бұрын
Personally, I don't use guards for web and api, I use the same users table with roles/permissions and with Sanctum for API. So I've never encountered that problem. For authorization of SPA with Vue, see our take in this video: kzbin.info/www/bejne/gJLXoXSLoZuSa6c
@MrDragos360
@MrDragos360 3 жыл бұрын
@@LaravelDaily It seems I missed that video. Thanks for it. It is really graet. Now I have to redisign 2 SPAs or even 3 :)) About guards, well, I have a project where the dashboard is an SPA that is authentificated via Sanctum and a client area(a store) that will be a "clasic" web app with Blade fiels and jQuery. That is where the problem with 2 guards comes from. @casl/vue can be used with Bouncer and a "hybird" site(SPA + Blade), right ? I think for this project I will kepp simple roles for now, the deadline is close and I am already a behind the plan.
@aurelianspodarec2629
@aurelianspodarec2629 2 жыл бұрын
Gold.
@muhammadumarsotvoldiev8768
@muhammadumarsotvoldiev8768 9 ай бұрын
Thank you very much
@ubirash
@ubirash 2 жыл бұрын
how to use gates for multiple guards. Is it okay to use duplicate Gate names for separate guard roles?
Laravel Junior Code Review: 12 Tips on Everything
15:30
Laravel Daily
Рет қаралды 75 М.
Jetstream/Fortify Multi-Auth: Roles, Permissions and Guards
19:00
Laravel Daily
Рет қаралды 100 М.
Who's spending her birthday with Harley Quinn on halloween?#Harley Quinn #joker
01:00
Harley Quinn with the Joker
Рет қаралды 20 МЛН
the balloon deflated while it was flying #tiktok
00:19
Анастасия Тарасова
Рет қаралды 36 МЛН
Mia Boyka х Карен Акопян | ЧТО БЫЛО ДАЛЬШЕ?
1:21:14
Что было дальше?
Рет қаралды 10 МЛН
Junior Code Review: Laravel Routes, Middleware, Validation and more
19:57
Authorization in Laravel: Can You Do That?
8:29
Laravel
Рет қаралды 10 М.
Laravel Service Providers: All You Need to Know
13:13
Laravel Daily
Рет қаралды 67 М.
Laravel Eloquent: Deeper Relationships with One Query
10:37
Laravel Daily
Рет қаралды 143 М.
Laravel Security: Top 7 Mistakes Developers Make
11:16
Laravel Daily
Рет қаралды 85 М.
Laravel SPA Authentication - setup and common mistakes
16:55
Who's spending her birthday with Harley Quinn on halloween?#Harley Quinn #joker
01:00
Harley Quinn with the Joker
Рет қаралды 20 МЛН