sonars / multi-auth
Multiple authentication for Laravel 5.2 & 5.3
Installs: 1 798
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 2
Open Issues: 1
Requires
- php: >=5.6.0
This package is not auto-updated.
Last update: 2018-06-27 09:14:19 UTC
README
Sonars Multiple Authentication for Laravel 5.2 & 5.3
php artisan multiauth:install {guard} -f
What it does?
With one simple command you can setup multi auth for your Laravel 5.2 & 5.3 project. The package installs:
- Model
- Migration
- Controllers
- Notification
- Routes
- routes/web.php
- {guard}/login
- {guard}/register
- {guard}/logout
- password reset routes
- routes/{guard}.php
- {guard}/home
- Middleware
- Views
- Guard
- Provider
- Password Broker
- Settings
- {guard}/login
- routes/web.php
Usage
Step 1: Install Through Composer
composer require sonars/multi-auth
Step 2: Add the Service Provider
You'll only want to use these package for local development, so you don't want to update the production providers
array in config/app.php
. Instead, add the provider in app/Providers/AppServiceProvider.php
, like so:
public function register() { if ($this->app->environment() == 'local') { $this->app->register('Sonars\MultiAuth\MultiAuthServiceProvider'); } }
( OR )
config/app.php return [ .... .... 'providers' => [ .... .... Sonars\MultiAuth\MultiAuthServiceProvider::class ], .... .... .... ]
Step 3: Install Multi-Auth files in your project
php artisan multiauth:install {singular_lowercase_name_of_guard} -f
//examples
php artisan multiauth:install admin -f
php artisan multiauth:install employee -f
php artisan multiauth:install customer -f
Notice:
If you don't provide -f
flag, it will not work. It is a protection against accidental activation.
Step 4: Migrate new model table
php artisan migrate
Step 5: Try it
Go to: http://url_to_your_proejct/guard/login
Example: http://project/admin/login
Options
If you don't want model and migration use --model
flag.
php artisan multiauth:install admin -f --model
If you don't want views use --views
flag.
php artisan multiauth:install admin -f --views
If you don't want routes in your routes/web.php
file, use --routes
flag.
php artisan multiauth:install admin -f --routes
Files which are changed and added by this package
- config/auth.php
-
add guards, providers, passwords
-
app/Http/Providers/RouteServiceProvider.php
-
register routes
-
app/Http/Kernel.php
-
register middleware
-
app/Http/Middleware/
- middleware for each guard
-
-
app/Http/Controllers/{Guard}Auth/
-
new controllers
-
app/Http/{Guard}.php
-
new Model
- app/Notifications/{Guard}ResetPassword.php
- reset password notification
- app/Notifications/{Guard}ResetPassword.php
-
database/migrations/
-
migration for new model
-
routes/web.php
-
register routes
-
routes/{guard}.php
-
routes file for given guard
-
resources/views/{guard}/
- views for given guard
-
-
-
-
-
-
-