37 lines
808 B
PHP
37 lines
808 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Database\Factories\OauthScopeFactory;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
|
|
class OauthScope extends Model
|
|
{
|
|
/** @use HasFactory<OauthScopeFactory> */
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'name',
|
|
'display_name',
|
|
'description',
|
|
'claims',
|
|
'is_active',
|
|
];
|
|
|
|
public function clients(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(OauthClient::class, 'oauth_client_scope', 'scope_id', 'client_id')
|
|
->withTimestamps();
|
|
}
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'claims' => 'array',
|
|
'is_active' => 'boolean',
|
|
];
|
|
}
|
|
}
|