public function execute(callable $next) { if ($this->auth->isLoggedIn() || !$this->request->isGet() || !isset($_COOKIE['pckg.auth.autologin'])) { return $next(); } $cookie = unserialize($_COOKIE['pckg.auth.autologin']); foreach ($cookie as $provider => $data) { $this->auth->useProvider($provider); $this->auth->autologin($data['user_id']); } return $next(); }
public function auth($provider = null) { if (!$this->auth) { $this->auth = resolve(Auth::class); } if ($provider) { $this->auth->useProvider($provider); } return $this->auth; }