47 lines
977 B
PHP
47 lines
977 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class OauthAuthorizationCode extends Model
|
|
{
|
|
protected $fillable = [
|
|
'code_hash',
|
|
'authorization_id',
|
|
'user_id',
|
|
'client_id',
|
|
'redirect_uri',
|
|
'scope',
|
|
'nonce',
|
|
'expires_at',
|
|
'consumed_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',
|
|
'consumed_at' => 'datetime',
|
|
'revoked_at' => 'datetime',
|
|
];
|
|
}
|
|
}
|