Session in Laravel

0

I have a question regarding the sessions that are due in Laravel, as they will know in the file session.php there is a variable called lifetime that there is configured the time in which you want a session to be alive.

The issue that I do not know how to do is that if the session expires or it dies autamatically it will go to the login and the application will be closed.

Why do I ask you this? because it happens that I have a dashboard and when the session dies by clicking on any of the links in the dashboard what I get is a window for you to enter username and password, when you enter username and password, it shows me the view you just clicked. ..

Ex: I was clicking on a link to Users and how the session died shows me user window and password ...

But when I click on that link it does not show me any information, checking the records in the browser console I see that the XSFR-TOKEN also dies and the only way that everything works to normal is refreshing the whole site.

So what I'm looking for is that if the session died, it will redirect immediately to login ..

The issue is: There is some Laravel functionality that I can tell you:

If Session is dead then go to Login ??? I do not know if I explain.

I hope you can help me with this ... thank you very much.

    
asked by jose angarita 20.10.2018 в 22:57
source

1 answer

-2

If you signed in with the laravel documentation link it is necessary to add in each of your controllers the constructor for auth:

public function __construct()
{
    $this->middleware('auth');
}
    
answered by 22.10.2018 в 23:45