install, uninstall. pack to ModuleService
This commit is contained in:
@ -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 => "Активный",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
@ -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' => ''
|
||||
];
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user