koel/app/Services/TokenManager.php
2020-09-06 20:21:39 +02:00

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();
}
}