rawaby88/portal
Portal ⾨
This package adding new guard ['portal'] to use on authenticated routes.
it will check if user has valid Token and permissions to endpoint
Installation
You can install the package via composer:
composer require rawaby88/portal
Usage
Add Portable trait to User model;
use Rawaby88\Portal\Portable;
use Portable;
Run migrate to update user table:
php artisan migrate
Migration Customization
If you are not going to use Portal's default migrations, you should call the
Portal::ignoreMigrations();
method in the register method of your
App\Providers\AppServiceProvider class.
You may export the default migrations by executing the following command:
php artisan vendor:publish --tag=portal-migrations
Usage by adding middleware 'auth:portal' to endpoints
Route::middleware('auth:portal')->get('/user', function (Request $request) {
return auth()->user()->token;
});
auth() functions will be available for you to use
auth()->check();
auth()->id();
auth()->user();
auth()->user()->token;
auth()->user()->appliance;
//you can also call other param as credit
auth()->user()->getData('credit');
auth()->user()->getData('workspace');
if you would like to change data stored in user table You may export the default config by executing the following command:
php artisan vendor:publish --tag=portal-config
[/config/portal.php]
return [
'auth_endpoint' => env( 'PORTAL_AUTH_ENDPOINT', '172.17.0.1/api/auth/token/check/' ),
'expiration' => null,
//user mode namespace
'user_model' => env( 'PORTAL_USER_MODEL', 'App\Models\User' ),
// Mapping data from response to database
//add or remove fields as you wish
'db_user_fields' => [
'id' => 'user_id',
'name' => 'name',
'email' => 'email'
],
// primary key for user table
'user_model_key' => 'user_id',
// primary key type -- don't change
'user_model_key_type' => 'string',
];
Security
If you discover any security related issues, please email github@dreamod.pl instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
Related Packages
RedminPortal is a backend administrating tool for Content Management and Ecommer...
Cloud native, API first Laravel eCommerce package with integrated AI for ultra-f...
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| 3.0.1 | ^7.3 || | ^8.0 | | MIT | |
| 3.0.0 | ^7.3 || | ^8.0 | | MIT | |
| 2.4.6 | ^7.3 || | ^8.0 | | MIT | |
| 2.4.5 | ^7.3 || | ^8.0 | | MIT | |
| 2.4.4 | ^7.3 || | ^8.0 | | MIT | |
| 2.4.3 | ^7.3 || | ^8.0 | | MIT | |
| 2.4.2 | ^7.3 || | ^8.0 | | MIT | |
| 2.4.1 | ^7.3 || | ^8.0 | | MIT | |
| 2.4.0 | ^7.3 || | ^8.0 | | MIT | |
| 2.3.1 | ^7.3 || | ^8.0 | | MIT | |
| 2.3.0 | ^7.3 || | ^8.0 | | MIT | |
| 2.2.3 | ^7.3 || | ^8.0 | | MIT | |
| 2.2.2 | ^7.3 || | ^8.0 | | MIT | |
| 2.2.1 | ^7.3 || | ^8.0 | | MIT | |
| 2.2.0 | ^7.3 || | ^8.0 | | MIT | |
| 2.1.6 | ^7.3 || | ^8.0 | | MIT | |
| 2.1.5 | ^7.3 || | ^8.0 | | MIT | |
| 2.1.4 | ^7.3 || | ^8.0 | | MIT | |
| 2.1.3 | ^7.3 || | ^8.0 | | MIT | |
| 2.1.2 | ^7.3 || | ^8.0 | | MIT | |
| 2.1.1 | ^7.3 || | ^8.0 | | MIT | |
| 2.1.0 | ^7.3 || | ^8.0 | | MIT | |
| 2.0.2 | ^7.3 || | ^8.0 | | MIT | |
| 2.0.1 | ^7.3 || | ^8.0 | | MIT | |
| 2.0 | ^8.0 | ^9.0 | MIT | |
| 1.3.2 | ^7.3 || | ^8.0 | MIT | |
| 1.3.1 | ^7.3 || | ^8.0 | MIT | |
| 1.3.0 | ^7.3 || | ^8.0 | MIT | |
| 1.2.0 | ^7.3 || | ^8.0 | MIT | |
| 1.1.1 | ^7.3 || | ^8.0 | MIT |
Showing the latest 30 of 51. See every release on Packagist