moonshine-software / moonshine

Laravel Admin panel and more. Simple for beginners and powerful for experts. Using Blade, Alpine.js and Tailwind CSS.
https://moonshine-laravel.com
MIT License
720 stars 95 forks source link

Multiple authentication using moonshine for both cabinets #1228

Closed timurI007 closed 2 weeks ago

timurI007 commented 2 weeks ago

Description

I thought Multiple authentication using moonshine for both cabinets was possible, but when I started I ran into a problem with Profile in Layout: Profile Component in vendor: Снимок MoonShineAuth: Снимок2 But this can be solved by creating your own Profile component for Layout. For multiple authentication I use 'moonshine' guard and 'staff' guard. Two login forms in different route prefix (/staff and / for original users). That's why I need to change prefix in config of moonshine. Also if you look at the routes of moonshine, you will see that middleware for routes are from config, but I need changeable guard based on url. Снимок3 That's why in current versions of MoonShine it's impossible to make multipple authentication!

lee-to commented 2 weeks ago

no one forces you to use the configureRoutes method

Route::group([
            'prefix' => 'admin',
            'middleware' => 'moonshine',
            'as' => 'moonshine.',
        ], function() {
// Routes
});

Route::group([
            'middleware' => 'moonshine',
        ], function() {
// Other routes
});