You may need to set a conditional for the code above. I assume that you don't have a public_html on your local host.
Session cookie not being created
Hello!
I'm having this weird issue in localhost where session cookies is not being created.
This happened after we launched the app live; in order to do this, I had to change the public path from public to public_html and I had to add this to AppServiceProvider.php register() function:
$this->app->bind('path.public', function() {
return base_path() . '/public_html';
});
Server side everything is working fine but in localhost for some reason Laravel stopped creating the session cookie and because of this I'm having the TokenMismatchException (CSRF) validation error in my POST requests.
Any hint or suggesrion?
Solved the issue.
We had setup PERCH CMS with laravel. The issue was caused by Perch, it was echoing stuff before laravel could send headers and init the session. After we fixed this, session cookies were restored to normal behavior.
Thanks for your hints.
Please or to participate in this conversation.