Тёмный

Laravel Gates Policies Middleware And Guards | Laravel Core Concepts | Laravel Basics | Ajay Yadav 

Ajay yadav
Подписаться 14 тыс.
Просмотров 13 тыс.
50% 1

In this video Understand Laravel Gates Policies Middleware And Guards in detail, Laravel basic and Laravel Core Concepts. And When And How Use Laravel Gates Policies Middleware And Guards.
Middleware:
Typically runs on a route (but you can also run it on controller methods) and can be used to filter or inspect incoming requests.
One example would be auth, which determines if the person trying to request a particular route is authenticated (logged in) to the system. Another example would be to check that a request has a specific header (e.g. if you want to check that the app is sending a X-MYAPP-CUSTOMHEADER header or something)
As mentioned, middleware can be defined on a route (e.g. in web.php or api.php) or in a controller.
Gates:
Gates are functions defined in your AuthServiceProvider.php file (in the App\Providers folder) and specify what a user is allowed to do and what they're not allowed to do.
Policies:
Policies work similarly to gates, but just apply to a specific model and are stored in their own file (in App\Policies)
You can create one by using php artisan make:policy PostPolicy -m Post. It'll create a file called PostPolicy.php which will create a bunch of functions:
viewAny // Can the user even look at this model? If no, they'll be denied for all the below methods
view // Can the user look at the specified Post?
create // Can they create a new Post
update // Can they edit / update the specified Post?
delete // Can they (soft) delete the specified Post?
restore // Can they restore the specified (soft) deleted Post?
forceDelete // Can they force delete the specified Post?
Guards:
Guards are a way to specify how users are authenticated for requests. They're the definition of how the system should store and retrieve information about your users.
You can find the configuration in your config/auth.php file. A web guard is the traditional cookie store - so that web guard instructs Laravel to store and retrieve session information the classic way. The API guard, on the other hand, uses tokens. So you would use the API guard if you want to authenticate users and requests using an API token in the header (bearer) or query parameter.
Gates and Plicies video :
• Video
Admin And User Login :(Multi Auth - Guards )
• Laravel Admin And User...
Our Playlist:
Computer Facts: • Computer facts
Laravel User Management System :
• Laravel User Managemen...
Laravel Auth System :
• Laravel Multi Auth System
Laravel And Vuejs
• Laravel And Vuejs
Laravel Eloquent Relationships
• Laravel Eloquent Relat...
GitHub Link :
github.com/aja...
#GatesVsPolicies #MiddlewareVsGuards #LaravelCoreConcepts
Please subscribe to my channel and share the video with your friends.

Опубликовано:

 

11 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 14   
@aashishnayak8172
@aashishnayak8172 2 года назад
Thank you thank you soooo Much sir for making video on my suggestion thanks a lot 🙏🙏🙏🙏🥳
@ajay-yadav
@ajay-yadav 2 года назад
so nice of you 😊 , Keep watching
@jjplays404
@jjplays404 2 года назад
My fav instructor
@MrDante224
@MrDante224 4 месяца назад
Ja lekker bezig pik, ongetwijfelt hebben veel mensen hier wat aan.
@souvikkar7402
@souvikkar7402 2 года назад
Amazing topics boss🙏
@ajay-yadav
@ajay-yadav 2 года назад
Thanks and welcome
@dkchaudhary6273
@dkchaudhary6273 2 года назад
Great
@musasubatin5697
@musasubatin5697 Год назад
I am new in the laravel framework i want to know difference of guard based login system and role based login system. and when to use the both login with example what is the pros and cons of both system .??Please Answer This Question . your explanations is very good
@wichukorndandecha
@wichukorndandecha 2 года назад
Nice thx
@MukeshSharma-zz1lt
@MukeshSharma-zz1lt 2 года назад
Sir i need aap guards pr video bnao detail me , and without guard bhi authentication ho jati h kya ?,
@jobandhillonvloger
@jobandhillonvloger Год назад
informative vidio but sir voice clarr nhe aw rahe apki down down se he
@Mohamedzaki_io
@Mohamedzaki_io Год назад
Mark video as Indian tuts please.
@ShahzaibKhan-wh5hh
@ShahzaibKhan-wh5hh 2 года назад
sir laravel me duplicate image kese check hogi
@ajay-yadav
@ajay-yadav 2 года назад
Hash the image file and compare
Далее
The Tools I Use to Build Products in Laravel
19:00
Просмотров 28 тыс.
I built 10 web apps... with 10 different languages
14:23