public function getAuthUser() { if (Session::exists($this->container->settings['auth']['session'])) { return $this->container->user->where('id', Session::get($this->container->settings['auth']['session'])); } else { return null; } }
public function __invoke($request, $response, $next) { $view = $this->site->getContainer()->view->getEnvironment(); $this->checkRememberStatus($response); if (Session::exists($this->site->getContainer()->settings['auth']['session'])) { $this->site->auth = $this->site->getContainer()->user->where('id', Session::get($this->site->getContainer()->settings['auth']['session']))->first(); } $this->checkAccountStatus($response); $view->addGlobal('auth', $this->site->auth); return $next($request, $response); }