masoud5070 / vandarauthbasic
implement auth basic for vandar services
Requires
Requires (Dev)
- orchestra/testbench: ~5|~6
- phpunit/phpunit: ~9.0
This package is auto-updated.
Last update: 2024-12-21 18:47:48 UTC
README
This package implements the laravel's default auth.basic
middleware for vandar services:
Installation
Via Composer
$ composer require masoud5070/vandarauthbasic
If you do not run Laravel 5.5 (or higher), then add the service provider and alias in config/app.php
:
On the config\app.php
add this to the providers
array value:
"Masoud5070\VandarAuthBasic\VandarAuthBasicServiceProvider"
and this one on the alias
array value:
"VandarAuthBasic" => "Masoud5070\VandarAuthBasic\Facades\VandarAuthBasic"
Usage
First publish config file and select vandarauthbasic.config
tag with the command below:
$ php artisan vendor:publish
After config file was published you can change model_name
with your model and set your data that create into database with database_records
.
NOTE: When change model_name
with your model class, table name will automatically change with $table
of model.
NOTE: You should set ADMINS_TABLE_EMAIL
and ADMINS_TABLE_PASSWORD
on the .env
file, then run the migration for creating the table:
$ php artisan migrate
To generate the admin user into the admins
table run the command below:
$ php artisan vandar:admins-consideration
NOTE: This package uses Admin
model and admins
table by default.
Then add guard and provider to 'auth.php' config file:
'guards' => [ 'admin' => [ 'driver' => 'session', 'provider' => 'admins', ], ... ], 'providers' => [ 'admins' => [ 'driver' => 'eloquent', 'model' => \Masoud5070\VandarAuthBasic\Models\Admin::class, ], ],
After running this command and setting the provider, you can set the auth.basic:web
middleware on the routes you want:
$ Route::get('your-uri', 'YourController@method')->middleware('auth.basic:web');
Change log
Please see the changelog for more information on what has changed recently.
Testing
$ composer test
Contributing
Please see contributing.md for details and a todolist.
Security
If you discover any security related issues, please email author email instead of using the issue tracker.
Credits
License
MIT. Please see the license file for more information.