web-api/app/Foundation/PersonalAccessToken.php

26 lines
608 B
PHP
Raw Normal View History

2024-11-13 19:23:49 +08:00
<?php
namespace App\Foundation;
use Laravel\Sanctum\PersonalAccessToken as SanctumPersonalAccessToken;
class PersonalAccessToken extends SanctumPersonalAccessToken
{
protected $table = 'app_personal_access_tokens';
protected $fillable = ['name', 'token', 'abilities', 'expires_at', 'meta'];
protected $casts = [
'abilities' => 'json',
'meta' => 'json',
'last_used_at' => 'datetime',
'expires_at' => 'datetime',
];
public function addMeta($data)
{
$data = array_merge($this->meta, $data);
$this->update(['meta' => $data]);
}
}