xxxxxxxxxx
$this->renderable(function (\Exception $e) {
if ($e->getPrevious() instanceof \Illuminate\Session\TokenMismatchException) {
return redirect()->route('login');
};
});
xxxxxxxxxx
php artisan view:clear
php artisan cache:clear
php artisan route:clear
php artisan config:clear
xxxxxxxxxx
APP_URL="http://myapp.local"
SESSION_LIFETIME=1440
SESSION_DOMAIN=myapp.local
SESSION_SECURE_COOKIE=false
xxxxxxxxxx
dont forget to put @csrf in your form
// or if you has, maybe it's your session problem.
// make sure your session config in .env file is correct!
// for example:
APP_URL=https://your.domain.com
SESSION_DRIVER=cookie
SESSION_LIFETIME=120 // in minutes
SESSION_SECURE_COOKIE=true // true or false based on your domain SSL. if https then true, else false
xxxxxxxxxx
<form method="POST" action="/your-action-url">
@csrf
<!-- Rest of the form elements -->
<button type="submit">Submit</button>
</form>
xxxxxxxxxx
I have solved the session problem (419-page Expire) session as a database. I think it would be helpful.
Change .env variable to
SESSION_DRIVER=database
SESSION_LIFETIME=120
run this commands:
php artisan session:table
php artisan cache:clear
php artisan migrate