- Added `PassportServiceProvider` to configure token expiration intervals. - Updated `User` model with `HasApiTokens` trait and `OAuthenticatable` interface for Passport support. - Registered `PassportServiceProvider` in `bootstrap/providers.php`.
22 lines
506 B
PHP
22 lines
506 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Providers;
|
|
|
|
use Carbon\CarbonInterval;
|
|
use Illuminate\Support\ServiceProvider;
|
|
use Laravel\Passport\Passport;
|
|
|
|
class PassportServiceProvider extends ServiceProvider
|
|
{
|
|
public function register(): void {}
|
|
|
|
public function boot(): void
|
|
{
|
|
Passport::tokensExpireIn(CarbonInterval::minute(30));
|
|
Passport::refreshTokensExpireIn(CarbonInterval::days(15));
|
|
Passport::personalAccessTokensExpireIn(CarbonInterval::months(6));
|
|
}
|
|
}
|