25 خطوط
823 B
PHP
25 خطوط
823 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class CustomFieldDefinition extends Model
|
|
{
|
|
use SoftDeletes;
|
|
|
|
protected $fillable = ['entity_type', 'key', 'label', 'type', 'options', 'validation', 'visible_to_roles', 'default_value', 'sort_order', 'is_required', 'is_active', 'is_filterable', 'is_searchable', 'created_by'];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return ['options' => 'array', 'validation' => 'array', 'visible_to_roles' => 'array', 'is_required' => 'boolean', 'is_active' => 'boolean', 'is_filterable' => 'boolean', 'is_searchable' => 'boolean'];
|
|
}
|
|
|
|
public function values(): HasMany
|
|
{
|
|
return $this->hasMany(CustomFieldValue::class);
|
|
}
|
|
}
|