라라벨/라우팅

prefix, namespace

땀모 2020. 3. 29. 17:53

Route::group([

'namespace' => 'Dashboard',

'prefix' => 'book'

], function() {


Route::get('/', 'DashboardController@index');

});


Route::group(['prefix' => 'book'], function () {
Route::post('add', 'BookController@add');
Route::get('edit/{id}', 'BookController@edit');
Route::post('update/{id}', 'BookController@update');
Route::delete('delete/{id}', 'BookController@delete');
});



namespace : 디렉터리를 추가로 생성할 수 있음


prefix : 라우트에 접두사를 정의할 수 있음