PHP code example of garbetjie / laravel-auth-passport-client

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

    

garbetjie / laravel-auth-passport-client example snippets




// in config/auth.php

return [
    'guards' => [
        'client' => [
            'driver' => 'passport-client',
            'provider' => 'client',
        ]
    ],

    'providers' => [
        'client' => [
            'driver' => 'eloquent',
            'model' => Laravel\Passport\Client::class,
        ]
    ]
];



class MyController extends \App\Http\Controllers\Controller
{
    public function myAction(\Illuminate\Http\Request $request)
    {
        $client = request()->user('client');
        // or
        $client = $request->user('client');
    }
}