2017 © Pedro Peláez
 

library multi-auth

Laravel Multi Authentication

image

bmatovu/multi-auth

Laravel Multi Authentication

  • Sunday, July 22, 2018
  • by bmatovu
  • Repository
  • 2 Watchers
  • 6 Stars
  • 137 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 6 Forks
  • 0 Open issues
  • 13 Versions
  • 191 % Grown

The README.md

Laravel Multi-Authentication Package

Total Downloads Latest Stable Version Quality Coverage Unit Tests, (*1)

This package gives you the ability to separate user areas in your application., (*2)

E.g, an ecommerce application with customers, sellers, and administrators user areas using auth guards, (*3)

Prerequisite

This package only extends the official laravel/breeze starter kit, it doesn't regenerate the frontend assets [js, css - tailwind, vite, ...], (*4)

Therefore, you need to use it after scaffolding basic auth using Breeze., (*5)

Breaking Changes, (*6)

For old versions (Laravel v9 and below) refer to v11, (*7)

Installation

composer require bmatovu/multi-auth --dev

Scaffolding

php artisan multi-auth:install admin

Register service provider

config/app.php, (*8)

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

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

vite.config.js, (*9)

  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, (*10)

Recompile frontend assets

npm run build

Run Database Migrations

php artisan migrate

Possible approaches for separating user areas

Using sub-domains

Separate user areas by sub-domains., (*11)

I would use separate repos for each sub-domain, (*12)

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, (*13)

* What this package offers, (*14)

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, (*15)

I'd stay away from this approach as it'd more complex to maintain for large projects, (*16)

URI User Group
larastore.com customers, sellers, administrators

The Versions

13/05 2018

v1.1.1

1.1.1.0 https://bmatovu.com/packages/multi-auth

Laravel Multi Authentication

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

laravel authentication package multi

16/04 2018

v1.1.0

1.1.0.0 https://bmatovu.com/packages/multi-auth

Laravel Multi Authentication

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

laravel authentication package multi

07/04 2018

v1.0.3

1.0.3.0 https://bmatovu.com/packages/multi-auth

Laravel Multi Authentication

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

laravel authentication package multi

22/09 2017

1.0.x-dev

1.0.9999999.9999999-dev https://brianmatovu.com/laravel/packages/multi-auth

Laravel Multi Authentication

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

laravel authentication package multi

22/09 2017

v1.0.2

1.0.2.0 https://brianmatovu.com/laravel/packages/multi-auth

Laravel Multi Authentication

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

laravel authentication package multi

22/09 2017

v1.0.1

1.0.1.0 https://brianmatovu.com/laravel/packages/multi-auth

Laravel Multi Authentication

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

laravel authentication package multi

22/09 2017

v1.0.0

1.0.0.0 https://brianmatovu.com/laravel/packages/multi-auth

Laravel Multi Authentication

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

laravel authentication package multi