Skip to content

Routing

Marco E edited this page Aug 28, 2020 · 1 revision
  • Add the routing to the api.php file in the routes folder:
Route::group(['prefix' => 'v1'], function () {
    Route::apiResource('meeting', 'API\MeetingController');

    Route::resource('meeting/registration', 'API\RegistrationController')->only([
        'store', 'destroy'
    ]);

    Route::post('user', [
        'uses' => 'API\AuthController@store'
    ]);

    Route::post('user/signin', [
        'uses' => 'API\AuthController@signin'
    ]);
});
  • Test the routes directly on browser or download postman, you should always get the string It works! as a response in every case:
HTTP Method URL Controller Action
GET http://homestead.test/api/v1/meeting API\MeetingController@index
GET http://homestead.test/api/v1/meeting/1 API\MeetingController@show
POST http://homestead.test/api/v1/meeting API\MeetingController@store
PATCH http://homestead.test/api/v1/meeting/1 API\MeetingController@update
DELETE http://homestead.test/api/v1/meeting/1 API\MeetingController@destroy
DELETE http://homestead.test/api/v1/meeting/registration/1 API\RegistrationController@destroy
POST http://homestead.test/api/v1/meeting/registration API\RegistrationController@store
POST http://homestead.test/api/v1/user API\AuthController@store
POST http://homestead.test/api/v1/user/signin API\AuthController@signin

Clone this wiki locally