first
This commit is contained in:
72
kernel/app_modules/user_custom_fields/models/CustomField.php
Normal file
72
kernel/app_modules/user_custom_fields/models/CustomField.php
Normal 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 => 'Список',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user