I'm doing some tests with Laravel 5's RESTful APIs. I created the UserController
controller using the command php artisan make:controller UserController
, and updated routes.php
like so:
Route::group(['prefix' => 'api'], function()
{
Route:resource('user', 'UserController');
Route::group(['prefix' => 'user'], function()
{
Route::get('', ['uses' => 'UserController@index']);
Route::get('{id}', ['uses' => 'UserController@show']);
Route::post('', ['uses' => 'UserController@create']);
Route::put('{id}', ['uses' => 'UserController@edit']);
Route::delete('{id}', ['uses' => 'UserController@destroy']);
});
});
When testing it, the only working method is GET
, others do fail throwing this exception:
TokenMismatchException in compiled.php line 2440:
I'd appreciate if you could give me an hand out with this, thank you.