This commit is contained in:
2025-07-14 12:15:41 +03:00
parent a64ed080bb
commit 273ac72207
974 changed files with 483955 additions and 14 deletions

View File

@@ -0,0 +1,72 @@
<?php
namespace kernel\app_modules\user_custom_fields\models;
use Illuminate\Database\Eloquent\Model;
// Добавить @property
/**
* @property int $id
* @property int $status
* @property string $slug
* @property string $label
* @property string $type
* @property string $entity
* @property string $field_options
*/
class CustomField extends Model
{
const DISABLE_STATUS = 0;
const ACTIVE_STATUS = 1;
const TYPE_STRING = 'string';
const TYPE_SELECT = 'select';
protected $table = 'custom_field';
protected $fillable = ['slug', 'label', 'type', 'entity', 'field_options', 'status']; // Заполнить массив. Пример: ['label', 'slug', 'status']
public static function labels(): array
{
// Заполнить массив
// Пример: [
// 'label' => 'Заголовок',
// 'entity' => 'Сущность',
// 'slug' => 'Slug',
// 'status' => 'Статус',
// ]
return [
'slug' => 'Slug',
'label' => 'Название',
'type' => 'Тип',
'entity' => 'Сущность',
'field_options' => 'Опции поля',
'status' => 'Статус',
];
}
/**
* @return string[]
*/
public static function getStatus(): array
{
return [
self::DISABLE_STATUS => "Не активный",
self::ACTIVE_STATUS => "Активный",
];
}
/**
* @return string[]
*/
public static function getTypes(): array
{
return [
self::TYPE_STRING => 'Текст',
self::TYPE_SELECT => 'Список',
];
}
}