Files
qztool/backend/app/Models/OauthClient.php
T
DevandCursor 60daff2365 搭建轻舟一期门户、后台和统一登录。
让分类、会员和示例工具共用同一账号,本地即可跑通登录与授权。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-09 16:46:35 +08:00

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);
}
}