34 lines
776 B
PHP
34 lines
776 B
PHP
<?php
|
|||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||
|
|
|
||
|
|
class OauthAccessToken extends Model
|
||
|
|
{
|
||
|
|
protected $fillable = [
|
||
|
|
'token_hash', 'oauth_client_id', 'user_id', 'scopes', 'entitlement_version', 'expires_at', 'revoked_at',
|
||
|
|
];
|
||
|
|
|
||
|
|
protected function casts(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'scopes' => 'array',
|
||
|
|
'entitlement_version' => 'integer',
|
||
|
|
'expires_at' => 'datetime',
|
||
|
|
'revoked_at' => 'datetime',
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
public function client(): BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(OauthClient::class, 'oauth_client_id');
|
||
|
|
}
|
||
|
|
|
||
|
|
public function user(): BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(User::class);
|
||
|
|
}
|
||
|
|
}
|