install, uninstall. pack to ModuleService

This commit is contained in:
2024-10-09 16:42:20 +03:00
parent fa2676ddb2
commit 9abfdd2fd9
70 changed files with 2317 additions and 57 deletions

View File

@ -0,0 +1,46 @@
<?php
namespace kernel\app_modules\tag\models;
use Illuminate\Database\Eloquent\Model;
/**
* @property int $id
* @property string $label
* @property string $entity
* @property string $slug
* @property int $status
* @method static where(int[] $array)
* @method static find($id)
*/
class Tag extends Model
{
const DISABLE_STATUS = 0;
const ACTIVE_STATUS = 1;
protected $table = 'tag';
protected $fillable = ['label', 'entity', 'slug', 'status'];
public static function labels(): array
{
return [
'label' => 'Заголовок',
'entity' => 'Сущность',
'slug' => 'Slug',
'status' => 'Статус',
];
}
/**
* @return string[]
*/
public static function getStatus(): array
{
return [
self::DISABLE_STATUS => "Не активный",
self::ACTIVE_STATUS => "Активный",
];
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace kernel\app_modules\tag\models\forms;
use kernel\FormModel;
class CreateTagForm extends FormModel
{
public function rules(): array
{
return [
'label' => 'required|min-str-len:5|max-str-len:30',
'entity' => 'required|min-str-len:1|max-str-len:50',
'slug' => '',
'status' => ''
];
}
}