pribumi/beyondauth

Complete User Auth For Laravel 5.2.x

dev-master 2017-10-18 17:37 UTC

This package is auto-updated.

Last update: 2024-10-10 06:13:24 UTC


README

SensioLabsInsight Build Status Dependency Status StyleCI codecov PHP-Eye License

What is BeyondAuth? .... tobe continued

Installing Package

composer require pribumi/beyondauth

Setup

After updating, add the service provider to the providers array in config/app.php

'providers' => [
	// blahh.. blahhh..
	Pribumi\BeyondAuth\Providers\BeyondAuthServiceProvider::class,
]

Also add the aliases to the aliases array in config/app.php

'aliases' => [
	// blahh.. blahhh..
	'BeyondAuth'  => Pribumi\BeyondAuth\Facades\BeyondAuth::class,
]

Run command from your console composer dump-autoload

Replace code on guards array in config/auth.php like this

'web_admins' => [
	'driver' => 'session',
    'provider' => 'users'
],

And also on providers array too

'users' => [
    'driver' => 'eloquent',
    'model' => Pribumi\BeyondAuth\Models\User::class,
],

Change default guard

	'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

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

$userfields = \BeyondAuth::users()->find(1)->userfields()->get();
echo json_encode($userfields);

Get Roles From Existing User

$uservalues = \BeyondAuth::users()->find(1)->roles()->get();
echo json_encode($uservalues);

Get Custom Fields Value From Existing User

$uservalues = \BeyondAuth::users()->find(1)->uservalues()->get();
echo json_encode($uservalues);

Testing

Work on progress...

License

The MIT License (MIT)

Copyright (c) 2017 Sean Tymon

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:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

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.