라우트 내부의 함수를 사용하여 컨트롤러 이름을 반환해야합니다. 이것이 내 라우터 코드입니다.라우트에서 laravel의 함수를 사용하는 방법
Route::group(['middleware'=>'auth'],function(){
Route::Resource('profile', return_controller(session()->get('category')));
});
function return_controller($category_id) {
switch ($category_id) {
case 1: return 'ServicesHallController';
break;
case 2: return 'ServicesBeautycenterController';
break;
case 3: return 'ServicesDressController';
break;
case 4: return 'ServicesCarController';
break;
case 5: return 'ServicesPhotographyController';
break;
case 6: return 'ServicesHoneymoonController';
break;
}
}
대신 특정 컨트롤러 나 요청을 라우팅하기위한 컨트롤러에 요청을 보낼 미들웨어를 사용하십시오. – jaysingkar
'session() -> get ('category')'는'category_id'를 리턴 할 것이고 카테고리? –