public function __construct() { $this->request = RequestModel::currentRequest(); // provide all controllers with access to the request data $this->session = SessionModel::currentSession(); // provide all controllers with access to the session data }
public function __construct($error = false) { // Some checks shouldn't be done when we've encountered a fatal error, like a Redis issue, which will cause infinite recursion! if (!$error) { $session = SessionModel::currentSession(); if ($user = $session->user()) { $flashQ = new FlashQueue($user); while ($flash = $flashQ->getFlash()) { $this->globals['flash_queue'][] = $flash; } $this->globals['websites_with_access'] = array_map(function ($website) { return get_object_vars($website); // convert to array... }, $user->websitesWithAccess()); } } // Globals $this->globals['app_name'] = AppConfig::getValue('app_name'); // Clean Globals self::stripHTML($this->globals); }