PhpDev.App
mtvbrianking/multi-auth

mtvbrianking/multi-auth

Stars: 169

Forks: 25

Pull Requests: 11

Issues: 36

Watchers: 10

Last Updated: 2022-08-25 04:13:45

Laravel Multi-Authentication Package

License: MIT License

Languages: PHP

https://github.com/mtvbrianking/multi-auth-diy

Laravel Multi-Authentication Package

Total Downloads Latest Stable Version License Build Status

This package simplifies multi authentication for your Laravel project, it will scaffold all the files you need for creating a custom guard as well as setting it up ready for use.

Version Compatibility

Laravel Package Installation
6.0 8.x composer require bmatovu/multi-auth ^8.0
7.0 9.x composer require bmatovu/multi-auth ^9.0
8.0 10.x composer require bmatovu/multi-auth ^10.0
9.0 master composer require bmatovu/multi-auth

Bootstrapping

php artisan multi-auth:install {guard}

Default guard is named: admin be sure to use a guard name that suits your needs. This command will scaffold configurations, controllers, middleware, migrations, models, factories, notifications, routes, and views; to get you started.

See a full list of files created, or affected at files.md

Run Database Migrations

php artisan migrate

Getting started

Compile CSS and JS (Optional)

The Bootstrap and Vue scaffolding provided by Laravel as of version 6.0 is now located in the laravel/ui Composer package.

There's consideration to move aware from laravel/ui to laravel/breeze

Note: This should only be done for fresh installations.

composer require laravel/ui

php artisan ui bootstrap

# php artisan ui bootstrap --auth

npm install && npm run dev

Serve application

http://127.0.0.1:8000/{guard}

Extras

Check guards

$ php artisan tinker
...
>>> config('auth.guards');

Access guard instance:

Specify the guard instance you would like to use, eg using admin guard...

Auth::guard('admin')->user();

Check routes:

To find out which routes have been created for your guard.

php artisan route:list

Email verification:

You may require users to verify their email addresses before using the application. Read the wiki on how to enable this.

Reporting bugs

If you've stumbled across a bug, please help us by leaving as much information about the bug as possible, e.g.

  • Steps to reproduce
  • Expected result
  • Actual result

This will help us to fix the bug as quickly as possible, and if you wish to fix it yourself feel free to fork the package and submit a pull request!