PHP code example of kamoca / laravel-jwt-database-blacklist

1. Go to this page and download the library: Download kamoca/laravel-jwt-database-blacklist 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/ */

    

kamoca / laravel-jwt-database-blacklist example snippets


    'storage' => Kamoca\JwtDatabaseBlacklist\Providers\Storage\Illuminate::class,
    

    'blacklist_enabled' => env('JWT_BLACKLIST_ENABLED', true),
    

use Tymon\JWTAuth\Facades\JWTAuth;
use Auth;

public function logout()
{
    // These will store {"valid_until":...} in the `jwt_blacklists` table
    Auth::logout();
    auth()->logout();

    // These will store 'forever' in the `jwt_blacklists` table
    JWTAuth::invalidate(JWTAuth::getToken(), true);
}
bash
php artisan vendor:publish --tag=jwt-blacklist-migrations
php artisan migrate