mardi 9 août 2016

How to use function in route at laravel

I need to use function inside route to return controller name //This is my code in

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;
    }
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire