Route::group(['prefix' => 'comments'], function () { Route::get('/', 'CommentController@index'); Route::get('/{id}', 'CommentController@show')->where('id', '[0-9]+'); Route::post('{id}/edit', 'CommentController@update')->where('id', '[0-9]+'); Route::post('{id}/delete', 'CommentController@destroy')->where('id', '[0-9]+'); Route::post('{id}/restore', 'CommentController@restore')->where('id', '[0-9]+'); }); // /api/user Route::group(['prefix' => 'user'], function () { Route::post('{username}/ban', 'UserController@ban'); }); // /api/video Route::group(['prefix' => 'video'], function () { Route::get('{id}', function ($id) { $res = \App\Models\Video::with(['category', 'user' => function ($query) { $query->addSelect('username', 'id'); }])->find($id); if (!$res) { return response(['message' => 'Video not found'], 404); } return $res; })->where('id', '[0-9]+'); Route::post('{id}/delete', 'VideoController@destroy')->where('id', '[0-9]+'); Route::post('{id}/tag', 'VideoController@tag')->where('id', '[0-9]+'); Route::post('{id}/untag', 'VideoController@untag')->where('id', '[0-9]+'); Route::post('upload', 'VideoController@store')->middleware('auth.basic'); }); Route::post('upload', 'VideoController@store'); }); Route::get('{id}', 'VideoController@show')->where('id', '[0-9]+'); Route::get('{id}/fav', 'VideoController@favorite')->where('id', '[0-9]+');