public function before() { parent::before(); // setup login and logout callbacks Warden::after_authentication(function ($user) { Session::set('warden.user.username', $user->username); //add username to the session so it can be used for chat }); Warden::before_logout(function ($user) { Session::delete('warden.user.username'); //delete username from the session when we logout }); // Assign current_user to the instance so controllers can use it $this->user = Warden::check() ? Warden::current_user() : null; // Set a global variable so views can use it View::set_global('current_user', $this->user); $this->client_scripts_included = array(); $this->template->scripts = array(); $this->template->css = array(); $this->template->metatags = array(); $this->include_client_scripts(); }