Samed
Samed

Reputation: 9

How to make custom POST request in Laravel?

I tried to do the custom POST request in Laravel without form, therefore I get error:

TokenMismatchException in VerifyCsrfToken.php line 68:

So, how can I fix it?

Upvotes: 1

Views: 402

Answers (2)

AddWeb Solution Pvt Ltd
AddWeb Solution Pvt Ltd

Reputation: 21681

Add this to the form in your view:

<input type="hidden" name="_token" value="{{ csrf_token() }}">

It should solve this.

Upvotes: 0

Alexey Mezenin
Alexey Mezenin

Reputation: 163768

You should add token to the request:

{{ csrf_field() }}

If you're using Ajax, read this.

Upvotes: 3

Related Questions