Guest User

Untitled

a guest
Jul 16th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\Listeners;
  4.  
  5. use Laravel\Passport\Events\AccessTokenCreated;
  6. use Illuminate\Queue\InteractsWithQueue;
  7. use Illuminate\Contracts\Queue\ShouldQueue;
  8. use DB;
  9.  
  10. class RevokeOldTokens
  11. {
  12. /**
  13. * Create the event listener.
  14. *
  15. * @return void
  16. */
  17. public function __construct()
  18. {
  19. //
  20. }
  21.  
  22. /**
  23. * Handle the event.
  24. *
  25. * @param AccessTokenCreated $event
  26. * @return void
  27. */
  28. public function handle(AccessTokenCreated $event)
  29. {
  30. DB::table('oauth_access_tokens')
  31. ->where('id', '!=', $event->tokenId)
  32. ->where('user_id', $event->userId)
  33. ->where('client_id', $event->clientId)
  34. ->delete();
  35. }
  36. }
Add Comment
Please, Sign In to add comment