Beyond Auth
, (*1)
What is BeyondAuth? .... tobe continued, (*2)
Installing Package
composer require pribumi/beyondauth
Setup
After updating, add the service provider to the providers array in config/app.php, (*3)
'providers' => [
// blahh.. blahhh..
Pribumi\BeyondAuth\Providers\BeyondAuthServiceProvider::class,
]
Also add the aliases to the aliases array in config/app.php, (*4)
'aliases' => [
// blahh.. blahhh..
'BeyondAuth' => Pribumi\BeyondAuth\Facades\BeyondAuth::class,
]
Run command from your console composer dump-autoload, (*5)
Replace code on guards array in config/auth.php like this, (*6)
'web_admins' => [
'driver' => 'session',
'provider' => 'users'
],
And also on providers array too, (*7)
'users' => [
'driver' => 'eloquent',
'model' => Pribumi\BeyondAuth\Models\User::class,
],
Change default guard, (*8)
'defaults' => [
'guard' => 'web_admins',
'passwords' => 'users',
]
Publish BeyondAuth Configuration
php artisan vendor:publish --provider="Pribumi\BeyondAuth\Providers\BeyondAuthServiceProvider"
composer dumpautoload
Migrate
Before you test the code, make sure your application can connect to the database then run this command, (*9)
php artisan migrate
composer dumpautoload
php artisan db:seed --class=BeyondAuthSeeder
Register on Kernel
protected $routeMiddleware = [
// blahh.. blahhh..
'beyondauth' => \Pribumi\BeyondAuth\Http\Middleware\BeyondMiddleware::class
]
Models
- ApiKeyUsers
- FieldTypes
- Periode
- Company
- User
- UserActivation
- UserField
- UserFieldGroup
- UserFieldValue
- UserGroup
- UserMenus
- UserPermission
Periode Model
$periode = new \Pribumi\BeyondAuth\Models\Periode();
$findIdPeriode = $periode->find(3);
echo json_encode($findIdPeriode->usergroups);
User Model
Get Custom Fields From Existing User, (*10)
$userfields = \BeyondAuth::users()->find(1)->userfields()->get();
echo json_encode($userfields);
Get Roles From Existing User, (*11)
$uservalues = \BeyondAuth::users()->find(1)->roles()->get();
echo json_encode($uservalues);
Get Custom Fields Value From Existing User, (*12)
$uservalues = \BeyondAuth::users()->find(1)->uservalues()->get();
echo json_encode($uservalues);
Testing
Work on progress..., (*13)
License
The MIT License (MIT), (*14)
Copyright (c) 2017 Sean Tymon, (*15)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:, (*16)
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software., (*17)
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE., (*18)