让分类、会员和示例工具共用同一账号,本地即可跑通登录与授权。 Co-authored-by: Cursor <cursoragent@cursor.com>
34 lines
779 B
PHP
34 lines
779 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class OauthAuthCode extends Model
|
|
{
|
|
protected $fillable = [
|
|
'code_hash', 'oauth_client_id', 'user_id', 'redirect_uri', 'scopes', 'nonce',
|
|
'code_challenge', 'code_challenge_method', 'expires_at', 'consumed_at',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'scopes' => 'array',
|
|
'expires_at' => 'datetime',
|
|
'consumed_at' => 'datetime',
|
|
];
|
|
}
|
|
|
|
public function client(): BelongsTo
|
|
{
|
|
return $this->belongsTo(OauthClient::class, 'oauth_client_id');
|
|
}
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
}
|