让分类、会员和示例工具共用同一账号,本地即可跑通登录与授权。 Co-authored-by: Cursor <cursoragent@cursor.com>
37 lines
841 B
PHP
37 lines
841 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class OauthClient extends Model
|
|
{
|
|
protected $fillable = [
|
|
'name', 'client_id', 'secret_hash', 'redirect_uris', 'logout_uris', 'tool_id',
|
|
'is_first_party', 'is_public', 'status',
|
|
];
|
|
|
|
protected $hidden = ['secret_hash'];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'redirect_uris' => 'array',
|
|
'logout_uris' => 'array',
|
|
'is_first_party' => 'boolean',
|
|
'is_public' => 'boolean',
|
|
];
|
|
}
|
|
|
|
public function tool(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Tool::class);
|
|
}
|
|
|
|
public function allowsRedirect(string $uri): bool
|
|
{
|
|
return in_array($uri, $this->redirect_uris ?? [], true);
|
|
}
|
|
}
|