1. Go to this page and download the library: Download d076/sanctum-refresh-tokens 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/ */
use D076\SanctumRefreshTokens\Models\AuthenticatableUser;
class User extends AuthenticatableUser
{
}
use Illuminate\Support\Facades\Schedule;
Schedule::command('sanctum:prune-expired --hours=0')->hourly();
Schedule::command('sanctum:prune-refresh-expired --hours=0')->daily();
use D076\SanctumRefreshTokens\Services\TokenService;
/** @var \D076\SanctumRefreshTokens\Models\AuthenticatableUser $user */
(new TokenService($user))->createTokens();
(new TokenService($user))->deleteCurrentTokens();