← Laravel learning pathLaravel · Module 8 of 10
Authentication and authorisation
Add login with starter kits, then control access with gates and policies.
📖 Key ideas
- Starter kits like Laravel Breeze add login, register and reset pages.
- auth middleware protects routes: ->middleware("auth").
- Auth::user() returns the current user.
- Gates and Policies decide what users can do.
- Sanctum provides API tokens and SPA auth.
💡 Real-life example: Policies are rulebooks per object: who may edit this post? Only its author or an admin.
BreezeSimple auth starter kit
auth middlewareRequires login
PolicyAuthorisation rules for a model
SanctumAPI token authentication