1. Go to this page and download the library: Download rawaby88/portal library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rawaby88 / portal example snippets
use Rawaby88\Portal\Portable;
use Portable;
Route::middleware('auth:portal')->get('/user', function (Request $request) {
return auth()->user()->token;
});
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');
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',
];