painlesscode / breeze-multiauth

Multi authentication guard generator for laravel breeze.
Other
47 stars 10 forks source link

Where can I find specific route codes after creating a role? #3

Closed Mainul12501 closed 3 years ago

Mainul12501 commented 3 years ago

I want to customize route codes. For example, when I create an admin role, route is created like this in web.php : Route::multiauth('Admin', 'admin'); here route('admin.login/register/etc') runs.

But I want to customize it. Where can I find route codes after creating an admin multiauth role? like before: Route::post('/admin/login', ['ControllerName:: class, 'store'])->name('admin.login');

HazzazBinFaiz commented 3 years ago

I've used a mixin on Route to register authentication routes for multiauth function.

You can find it here

If you want to customize routes, you need to define all other necessary routes instead of using Route::multiauth()

sam-hsbu commented 3 years ago

I've used a mixin on Route to register authentication routes for multiauth function.

You can find it here

If you want to customize routes, you need to define all other necessary routes instead of using Route::multiauth()

Hi. Good job. Where do I have to put this file please ?

HazzazBinFaiz commented 3 years ago

I've used a mixin on Route to register authentication routes for multiauth function. You can find it here If you want to customize routes, you need to define all other necessary routes instead of using Route::multiauth()

Hi. Good job. Where do I have to put this file please ?

You can put all authentication route in different route file and include that file in web.php or you can define all the routes inside web.php. Both will work.

If you want to customize it, you have to define all the routes defined in mixin.

// assume that role name is admin
// remove Route::multiauth('Admin', 'admin'); and use your defined routes

Route::middleware(['auth:admin'])->name('admin.')->prefix(admin)->group(function() {
    Route::get('/', ["App\Http\Controllers\Admin\DashboardController", 'index']);
    Route::get('/dashboard', ["App\Http\Controllers\Admin\DashboardController", 'index'])->name('dashboard');

    /*---- rest of them ----*/
});
Route::middleware(['guest:admin'])->name('admin.')->prefix('admin')->group(function() {
    Route::get('/login', ["App\Http\Controllers\Admin\Auth\AuthenticatedSessionController", 'create'])
        ->name('login');

    /*--- rest of them ---*/
});