PHP code example of glesys / butler-auth

1. Go to this page and download the library: Download glesys/butler-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/ */

    

glesys / butler-auth example snippets


$token = $consumer->createToken(abilities: ['*'], name: 'my token')->plainTextToken;

// Delete access token by ID
AccessToken::find($id)->delete();

// Delete all tokens for a consumer
$consumer->tokens->map->delete();

// If "butler" is configured as your default guard
Route::view('/protected', 'protected')->middleware('auth');

// Or specify the guard
Route::view('/protected', 'protected')->middleware('auth:butler');
sh
composer an vendor:publish --tag=butler-auth-migrations
php artisan migrate