php - Laravel 5.0 extending the 'Logout' functionality -
i set sessions save database , added user_id field sessions table may display names of logged in users. in order laravel save id of user when log in(given laravel doesn't user_id column regularly), had add bit of code authenticate.php file handle that.
now, attempting set user_id field null
when user logs out because presently, since user_id field still contains user's id after log out, still displays them logged in though no longer logged in. looking extend auth/logout functionality without touching vendor files include function set user_id null on logout.
where might add function exactly? in authcontroller.php file? in routes.php adding in own declaration of auth/logout route?
if have questions me or need me better explain anything, let me know.
thanks.
you can put following function in authcontroller.php
override default function authenticatesandregistersusers
trait. , can change per need.
/** * log user out of application. * * @return \illuminate\http\response */ public function getlogout() { $this->auth->logout(); return redirect(property_exists($this, 'redirectafterlogout') ? $this->redirectafterlogout : '/'); }
Comments
Post a Comment