This package gives you the ability to separate user areas in your application.
E.g, an ecommerce application with customers, sellers, and administrators user areas using auth guards
This package only extends the official laravel/breeze
starter kit, it doesn't regenerate the frontend assets [js, css - tailwind, vite, ...]
Therefore, you need to use it after scaffolding basic auth using Breeze.
Breaking Changes
For old versions (Laravel v9 and below) refer to v11
composer require bmatovu/multi-auth --dev
php artisan multi-auth:install admin
config/app.php
'providers' => [
/*
* Package Service Providers...
*/
+ App\Modules\Admins\AdminServiceProvider::class,
],
vite.config.js
export default defineConfig({
plugins: [
laravel({
- input: 'resources/js/app.js',
+ input: [
+ 'resources/js/app.js',
+ 'resources/js/Admins/app.js',
+ ],
- ssr: 'resources/js/ssr.js',
+ ssr: [
+ 'resources/js/ssr.js',
+ 'resources/js/Admins/ssr.js',
+ ],
refresh: true,
}),
...
],
});
Read more about Inertia Server Side Rendering
npm run build
php artisan migrate
Separate user areas by sub-domains.
I would use separate repos for each sub-domain
URI | User Group |
---|---|
larastore.com | customers |
seller.larastore.com | sellers |
admin.larastore.com | administrators |
Separate user areas based on URLs. Restricted with auth guards
* What this package offers
URI | User Group |
---|---|
larastore.com | customers |
larastore.com/seller | sellers |
larastore.com/admin | administrators |
Restrict access based on the user's roles and permissions
I'd stay away from this approach as it'd more complex to maintain for large projects
URI | User Group |
---|---|
larastore.com | customers, sellers, administrators |