PHP code example of l3aro / passportless-for-laravel

1. Go to this page and download the library: Download l3aro/passportless-for-laravel 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/ */

    

l3aro / passportless-for-laravel example snippets


'guards' => [
    'passportless' => [
        'driver' => 'passportless',
        'provider' => 'users',
    ],
],

use l3aro\Passportless\Concerns\HasPassportless;

class User extends Authenticatable
{
    use HasPassportless;
}

$token = $user->createToken('iphone', ['orders:read', 'orders:write']);

// Show / store the plain-text token once. It is not stored in the database.
return ['token' => $token->plainTextToken];

Route::get('/orders', OrdersController::class)
    ->middleware(['auth:passportless', 'abilities:orders:read']);

Http::withToken($plainTextToken)->get('/api/orders');
bash
composer  vendor:publish --tag="passportless-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="passportless-config"