I found a solution:
This answer is for all the people who have already used {{ csrf_field() }} after the <form> tag in their view.blade.php file and have also run the php artisan key:generate command but are still getting the Token Mismatch error. These are the steps I took to resolve the TokenMismatchException error for one of my projects that was still in development.
Delete cache files from the following two folders within your laravel project:
storage/framework/sessions/
storage/framework/views/
After removing the cache files, clear your browser cache.
And everyone who uses {{Auth::user()->somefield}} everyone must check the authentication site visitors, for example:
<script>
var auth = 0;
@if({{Auth::check()}})
var auth = '{{Auth::user()->name}}';
@endif
</script>
And then problem will disappear.
It's mean that web-programmer shouldn't do something like:
<script>
alert('{{Auth::user()->id}}');
</script>
//Just for example..
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community