I've read different blogs and forums regarding my problem but have no luck. The problem is that when i tried my routes (Post, Delete, Put) with postman the result is always 400 (Bad Request) but my Get routes are all perfectly working. I already tried to comment VerifyCsrfToken in my kernel.php but still not working. Here is my route list.
In my routes.php,
Route::group(['prefix' => 'publications'], function()
{
Route::get('/{id}', [
'uses' => 'PublicationController@show'
]);
Route::post('/', [
'uses' => 'PublicationController@store'
]);
Route::put('/{id}', [
'uses' => 'PublicationController@update'
]);
Route::delete('/{id}', [
'uses' => 'PublicationController@destroy'
]);
});
And in my controller,
public function show($id)
{
return 'sdasdsadas';
}
public function store(Request $request)
{
return '1';
}
public function update(Request $request, $id)
{
return '2';
}
public function destroy($id)
{
return '3';
}
Controller return
are just a test whether the routes are entering the controller. And in my postman i'm accesing the route with http://localhost:8000/api/v1/publications/1
using delete and it returns 400 bad request. If you encounter this with laravel please share your experiences and how did you solve it. Thank you in advance.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire