43 lines
860 B
PHP
43 lines
860 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class OauthAccessToken extends Model
|
|
{
|
|
protected $fillable = [
|
|
'jti',
|
|
'authorization_id',
|
|
'user_id',
|
|
'client_id',
|
|
'scope',
|
|
'expires_at',
|
|
'revoked_at',
|
|
];
|
|
|
|
public function authorization(): BelongsTo
|
|
{
|
|
return $this->belongsTo(OauthAuthorization::class, 'authorization_id');
|
|
}
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
public function client(): BelongsTo
|
|
{
|
|
return $this->belongsTo(OauthClient::class, 'client_id');
|
|
}
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'expires_at' => 'datetime',
|
|
'revoked_at' => 'datetime',
|
|
];
|
|
}
|
|
}
|