30 خطوط
703 B
PHP
30 خطوط
703 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Setting extends Model
|
|
{
|
|
protected $fillable = [
|
|
'key', 'value', 'default_value', 'group', 'type', 'validation_rules',
|
|
'allowed_values', 'is_secret', 'is_public', 'is_runtime_enforced', 'description',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'validation_rules' => 'array',
|
|
'allowed_values' => 'array',
|
|
'is_secret' => 'boolean',
|
|
'is_public' => 'boolean',
|
|
'is_runtime_enforced' => 'boolean',
|
|
];
|
|
}
|
|
|
|
public function effectiveValue(): mixed
|
|
{
|
|
return $this->value ?? $this->default_value;
|
|
}
|
|
}
|