Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Providers;
- use App\Auth\CompositeGuard;
- use Illuminate\Auth\TokenGuard;
- use Illuminate\Foundation\Application;
- use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
- use MiladRahimi\LaraJwt\Guards\Jwt as JwtGuard;
- class AuthServiceProvider extends ServiceProvider
- {
- public function boot(): void
- {
- $this->registerPolicies();
- \Auth::extend('any_token', static function (Application $app) {
- $userProvider = \Auth::createUserProvider('users');
- $request = $app->make('request');
- $tokenGuard = new TokenGuard($userProvider, $request);
- $jwtGuard = new JwtGuard($userProvider, $request);
- return new CompositeGuard($tokenGuard, $jwtGuard);
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement