Chron
4 months ago

How can I group routes that have similar class names?

Posted 4 months ago by Chron

How can I group routes?

Route::namespace('Customer')->group(function (){
    Route::prefix('customer')->group(function (){
        Route::namespace('CustomerAuth')->group(function (){
            Route::post('login', '[email protected]');
            Route::post('register', '[email protected]');
            Route::name('customer.')->group(function (){
                Route::get('login', '[email protected]')->name('login');
                Route::post('logout', '[email protected]')->name('logout');
                Route::post('password/email', '[email protected]')->name('password.email');
                Route::get('password/reset', '[email protected]')->name('password.request');
                Route::post('password/reset', '[email protected]')->name('password.update');
                Route::post('password/reset/{token}', '[email protected]')->name('password.reset');
                Route::get('register', '[email protected]')->name('register');
            });
        });
    });
});

I have similar routes but with Admin, they have different login pages, namespaces, routes (like admin/register and customer/register), but same class names.

Please sign in or create an account to participate in this conversation.