Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 5 GET is working but POST method is not working

I am new to Laravel and I am facing a weird issue. In the routes I am calling a function through POST and GET method.

GET returns data but POST doesn't. Here is my simple code:

For POST

Route::post('register', function() {
    echo 'we are here';
});

For GET:

Route::get('register', function() {
    echo 'we are here';
});

Please help. Thank you.

like image 209
Zain SMJ Avatar asked May 09 '16 16:05

Zain SMJ


1 Answers

You need to include a CSRF token on every request (except GET).

https://laravel.com/docs/5.2/routing#csrf-protection

like image 112
Chris Avatar answered Oct 09 '22 19:10

Chris