How to use function in route at laravel
<p>I need to use function inside route to return controller name. This is my router code.</p>

<pre class="lang-php prettyprint-override"><code>Route::group(['middleware'=&gt;'auth'],function(){
    Route::Resource('profile', return_controller(session()-&gt;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;
    }
}
</code></pre>