Level 53
You need this {{ csrf_field() }}
2 likes
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
<form method="POST" action="/note/{{$show_card_note->id}}">
{{ method_field('PATCH') }}
<div class="form-group">
<textarea name="body" class="form-control">{{$show_card_note->body}}</textarea>
</div>
<div class="form-group">
<button type="submit" class="btn btn-success">Update Note</button>
</div>
</form>
Route::patch('note/{show_card_note}', 'NoteController@update');
public function edit(Note $show_card_note){
return view ('note.edit', compact('show_card_note'));
}
public function update(Request $request, Note $show_card_note){
$show_card_note->update($request->all());
return back();
}
please tell me what my wrong i am follow this video link
visit https://laracasts.com/series/laravel-5-from-scratch/episodes/10
THE ERROR SHOW -------
Whoops, looks like something went wrong.
1/1
TokenMismatchException in compiled.php line 3227:
in compiled.php line 3227
at VerifyCsrfToken->handle(object(Request), object(Closure))
at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9963
at Pipeline->Illuminate\Pipeline{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing{closure}(object(Request)) in compiled.php line 13474
at ShareErrorsFromSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9963
at Pipeline->Illuminate\Pipeline{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing{closure}(object(Request)) in compiled.php line 11964
at StartSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9963
at Pipeline->Illuminate\Pipeline{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
You need to have both:
{{ csrf_field() }}
{{ method_field('PATCH') }}
The method is for the form action and the craft is for the token required by Laravel.
Please or to participate in this conversation.