/
DATKAI
/
ITCUP
Обзор
Документация
Войти
/
DATKAI
/
ITCUP
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
app/Models/LicenseCustomField.php
48 строк
1 KB
ITCUP Admin
feat(licenses): модуль лицензий — ПО, ЭЦП, МЧД, отчётность 1С, SSL, домены
17 апр 2026, 12:19
17 апр 2026, 12:19
c0f135a
Код
Авторство
О чём код?
<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Support\Str; class LicenseCustomField extends Model { protected $fillable = [ 'license_type_id', 'name', 'slug', 'type', 'options', 'is_required', 'sort_order', ]; protected $casts = [ 'options' => 'array', 'is_required' => 'boolean', ]; public const TYPES = [ 'text' => 'Текст', 'textarea' => 'Многострочный текст', 'number' => 'Число', 'date' => 'Дата', 'select' => 'Выпадающий список', 'boolean' => 'Да/Нет', ]; protected static function booted(): void { static::creating(function (LicenseCustomField $field) { if (empty($field->slug)) { $field->slug = Str::slug($field->name, '_'); } }); } public function type(): BelongsTo { return $this->belongsTo(LicenseType::class, 'license_type_id'); } }