百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
M

multi-auth

> 后端框架
开源

Laravel 多重身份验证包

181 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

Laravel 多重身份验证包

Laravel Multi-Authentication Package

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

Prerequisite

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

Installation

bash
composer require bmatovu/multi-auth --dev

Scaffolding

bash
php artisan multi-auth:install admin

Register service provider

config/app.php

diff
  'providers' => [
      /*
      * Package Service Providers...
      */
+     App\Modules\Admins\AdminServiceProvider::class,
  ],

Register JS entry point in Vite (Inertia - Vue, React)

vite.config.js

diff
  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

Recompile frontend assets

bash
npm run build

Run Database Migrations

bash
php artisan migrate

Possible approaches for separating user areas

Using sub-domains

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

Using URLs*

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

Using roles

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

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

PHPauthenticationguardlaravellaravel-multi-authentication

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类后端框架
定价开源

> 相关工具

N
Node.js
基于 V8 的 JavaScript 运行时
D
Django
Python 高级 Web 框架
S
Spring Boot
Java 生态主流微服务框架