TOPIC COLLECTION
Auth.
A collection of 9 practical ideas to make everyday Laravel work a little smoother.
09 TIPS01Use Policies for Model-based AuthorizationWhen permissions depend on a specific model, keep the rules in a policy instead of repeating ownership checks across controllers. Laravel can discover a…Auth02Enable Two-factor Authentication with FortifyLaravel Fortify provides a TOTP-based two-factor sign-in flow, including challenge and recovery-code support. Install Fortify and run its published…Auth03Check Multiple Permissions at OnceIn addition to @can Blade directive, did you know you can check multiple permissions at once with @canany directive?Auth04Authenticate Users with More OptionsIf you only want to authenticate users that are also "activated", for example, it's as simple as passing an extra argument to Auth::attempt() .Auth05More Events on User RegistrationWant to perform some actions after new user registration? Head to app/Providers/EventServiceProvider.php and add more Listeners classes, and then in those…Auth06Did You Know About Auth::once()?You can login with user only for ONE REQUEST, using method Auth::once() . No sessions or cookies will be utilized, which means this method may be helpful…Auth07Change API Token on Users Password UpdateIt's convenient to change the user's API Token when its password changes. ModelAuth08Override Permissions for Super AdminIf you've defined your Gates but want to override all permissions for SUPER ADMIN user, to give that superadmin ALL permissions, you can intercept gates…Auth09Custom Authentication EventsLaravel's authentication system fires various events during the authentication process, allowing you to hook into these events and perform additional…Auth