PHP code example of egs33 / laravel-datastore-auth

1. Go to this page and download the library: Download egs33/laravel-datastore-auth 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/ */

    

egs33 / laravel-datastore-auth example snippets


    'providers' => [
        'users' => [
            'driver' => 'datastore'
        ]
    ],

$userConfig = [
    'name' => 'hoge',
    'email' => '[email protected]',
    'password' => 'secret'
];
$userProvider = Auth::createUserProvider('users');
$userProvider->create($userConfig);
// or
DatastoreAuth::create($userConfig);

$user = Auth::user(); // get current user
$isLoggedIn = Auth::check();

$user['name'] = 'new-name';
$user['group'] = 'new-group';
$user->save();

[
    'client_config' => [],
    'kind' => 'users',
    'cache' => [
        'isEnabled' => false,
        'keyPrefix' => \DatastoreAuth\DatastoreUserProvider::class . ':',
        'ttl' => null,
    ]
]