mirror of
https://github.com/koel/koel
synced 2024-11-24 13:13:05 +00:00
19 lines
378 B
PHP
19 lines
378 B
PHP
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
use App\Models\User;
|
|
use Laravel\Sanctum\NewAccessToken;
|
|
|
|
class TokenManager
|
|
{
|
|
public function createToken(User $user, array $abilities = ['*']): NewAccessToken
|
|
{
|
|
return $user->createToken(config('app.name'), $abilities);
|
|
}
|
|
|
|
public function destroyTokens(User $user): void
|
|
{
|
|
$user->tokens()->delete();
|
|
}
|
|
}
|