web-api/app/Foundation/PersonalAccessToken.php
梁朝伟 7f3db2ed48 init
2024-11-13 19:23:49 +08:00

26 lines
608 B
PHP

<?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]);
}
}