Laravel Permission Check: Controller, Policy or Global Scope?

preview_player
Показать описание
Let me show you a practical example with a few ways how to check if the record belongs to the same team as the logged in user.

- - - - -
Support the channel by checking out my products:

- - - - -
Other places to follow:
Рекомендации по теме
Комментарии
Автор

Small side note: use $this->authorize() instead of Gate::authorize() so you don’t have to import the Gate::class

erikjandelange
Автор

ive never used policies but i think i quickly understood how they work in this short video, thanks

drugoviic
Автор

Crap I better add this to my project 😮 totally forgot to do these checks 😮

JamesAutoDude
Автор

There are multiple weaknesses for global scoped "gates" uses: they are global; they are hidden; they do not fit to app that has multiple roles for users; they are placed in model (where you need to play the game of cat and mouse when you need to modify/add another role).

MichalKuzmicki
Автор

Hello can you maybe shot a vid about multi role and how things go like how to use policy or midleware in routes and some tips and tricks about it

homamal
Автор

Hi, I saw your video about livewire calendar and I want to ask you if you know any library that supports laravel 11 besides js libraries?

ІгорШтогрин-ыщ
Автор

Can you please make a video on Laravel 11 Providers which was given in config/app.php in Laravel 11 how to manage the provider and aliases

mnszaidi
Автор

Just register the policy in construct method

eduardoaranda
Автор

Csn anyone think of a scenario to have both policies and global scopes?

matthewjohnson