/
DATKAI
/
ITCUP
Обзор
Документация
Войти
/
DATKAI
/
ITCUP
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
app/Models/UserCustomField.php
43 строки
990 B
ITCUP Admin
Initial commit: ITCUP — базовая структура, инвентарь, задачник, пользователи
17 апр 2026, 09:29
17 апр 2026, 09:29
a2ae386
Код
Авторство
О чём код?
<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Str; class UserCustomField extends Model { protected $fillable = [ 'name', 'slug', 'type', 'options', 'is_required', 'is_visible_to_user', 'sort_order', ]; protected $casts = [ 'options' => 'array', 'is_required' => 'boolean', 'is_visible_to_user' => 'boolean', ]; public const TYPES = [ 'text' => 'Текст', 'textarea' => 'Многострочный текст', 'number' => 'Число', 'date' => 'Дата', 'select' => 'Выпадающий список', 'boolean' => 'Да/Нет', ]; protected static function booted(): void { static::creating(function (UserCustomField $field) { if (empty($field->slug)) { $field->slug = Str::slug($field->name, '_'); } }); } }