0
votes

enter image description here

Undefined variable: token (View: C:\xampp\htdocs\blog\resources\views\auth\passwords\email.blade.php)

4

4 Answers

0
votes

In the form you don't need to add $token, you are already using it in the form. So your form action should be

action="{{ route('password.request') }}" 

Also for csrf you can make input in the form by using following

{{ csrf_field() }}

0
votes

If you have used default auth(using php artisan make:auth) in laravel then change like this in \auth\passwords\email.blade.php file:

<form method="POST" action="{{ route('password.email') }}">
@csrf
0
votes

Hello I had same issue with my #laravel6 project where i was trying to call same method and view from different URL. I simply removed the second line after @csrf like this

<input type="hidden" name="token" value="{{ $token }}">

I removed this and its works fine. and about token there is a token from @csrf so everything works as it is.

-1
votes

You just don't need to add $token manually in the form, you can just use csrf_field() inside the form and it'll generate the hidden field with csrf token

Your code should be like this

<form method="POST" action="{{ route('password.request') }}">
    {{ csrf_field() }}
    .
    .
    .
</form>