I have a problem that I want to add a variable to a session after user login (I use Laravel 5 and its auth by artisan make:auth
. It looks like this: user->login->give_him_a_key->logout->delete_key
. I make a middleware
for this but I realize I cannot make middleware
run only once when the user does a login, then I go to the file AuthenticateUser.php
and add my code in function login
. My teacher said that it is not good because I change the code of laravel. He asked me to try to make it without changing the code of laravel.
I tried but cannot find how to catch $request
after a user login and make it run only once. I need some guidance.
Change routes according to your application