Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\Providers;
  4.  
  5. use App\Auth\CompositeGuard;
  6. use Illuminate\Auth\TokenGuard;
  7. use Illuminate\Foundation\Application;
  8. use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
  9. use MiladRahimi\LaraJwt\Guards\Jwt as JwtGuard;
  10.  
  11. class AuthServiceProvider extends ServiceProvider
  12. {
  13. public function boot(): void
  14. {
  15. $this->registerPolicies();
  16.  
  17. \Auth::extend('any_token', static function (Application $app) {
  18. $userProvider = \Auth::createUserProvider('users');
  19. $request = $app->make('request');
  20. $tokenGuard = new TokenGuard($userProvider, $request);
  21. $jwtGuard = new JwtGuard($userProvider, $request);
  22.  
  23. return new CompositeGuard($tokenGuard, $jwtGuard);
  24. });
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement