D
D
Dmitry2015-06-15 23:25:34
Laravel
Dmitry, 2015-06-15 23:25:34

How to redirect to routes correctly?

#################
##Админ. панель##
#################

// Тут редиректим на правильный роут
Route::get('admin', function() {
    return Redirect::route('panel');
});

// Правильный роут
Route::group(['prefix' => 'panel'], function()
{
    Route::get('', ['as' => 'panel', 'uses' => '[email protected]']);
});

Do I do everything right or can I somehow combine it more "beautifully"? I thought about Route::group , but two prefixes cannot be passed there, which is logical, but in my situation it would be handy.
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gladkovskiy, 2015-06-16
@another_dream

in 5.1, the naming of routes is done taking into account the group:

Route::group(['as' => 'admin::'], function () {
    Route::get('dashboard', ['as' => 'dashboard', function () {
        // Route named "admin::dashboard"
    }]);
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question