Ejemplo n.º 1
0
 public function handle($request, Closure $next)
 {
     if (($token = $request->cookie('flarum_remember')) && ($accessToken = AccessToken::where('id', $token)->first()) && ($user = $accessToken->user)) {
         $this->actor->setUser($user);
         $user->updateLastSeen()->save();
     }
     return $next($request);
 }
 public function handle($request, Closure $next)
 {
     if (($token = $request->cookie('flarum_remember')) && ($accessToken = AccessToken::where('id', $token)->first()) && $accessToken->user->isAdmin()) {
         $this->actor->setUser($accessToken->user);
     } else {
         die('ur not an admin');
     }
     return $next($request);
 }
Ejemplo n.º 3
0
 public function handle($request, Closure $next)
 {
     $header = $request->headers->get('authorization');
     if (starts_with($header, $this->prefix) && ($token = substr($header, strlen($this->prefix))) && ($accessToken = AccessToken::where('id', $token)->first())) {
         $this->actor->setUser($user = $accessToken->user);
         $user->updateLastSeen()->save();
     }
     return $next($request);
 }
 public function handle($command)
 {
     $token = AccessToken::generate($command->userId);
     $token->save();
     return $token;
 }