PHP code example of amin3536 / laravel-api-user-provider
1. Go to this page and download the library: Download amin3536/laravel-api-user-provider 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/ */
amin3536 / laravel-api-user-provider example snippets
return [
//.......
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
*/
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'api-token',
'provider' => 'users',
],
'admin-api' => [
'driver' => 'api-token',
'provider' => 'admins',
],
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
*/
'providers' => [
'users' => [
'driver' => 'api-provider',
'model' => App\Models\User::class,
//merged with base_url or you can use full path api here =>http://localhost/api/admin/
'url' => '/api/v1/user/'
],
'admins' => [
'driver' => 'api-provider',
'model' => App\Models\Admin::class,
'url' => '/api/v1/admin/'
],
],
/*
|--------------------------------------------------------------------------
| Base url path to to call Auth Service
|--------------------------------------------------------------------------
|
*/
'base-url'=>'localhost',
'TimeoutForRequestAuthServer'=>2
//.......
];
//...
public function boot()
{
$this->app->when(ExternalUserProvider::class)
->needs(DeserializerInterface::class)
->give(function () {
return new JsonToModel();
});
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.