2024-08-30 12:27:46 +03:00
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace kernel\models;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
|
2024-08-30 16:14:31 +03:00
|
|
|
|
/**
|
|
|
|
|
* @property int $id
|
|
|
|
|
* @property int parent_id
|
|
|
|
|
* @property string icon_file
|
|
|
|
|
* @property string icon_font
|
|
|
|
|
* @property string label
|
|
|
|
|
* @property string url
|
|
|
|
|
* @property int status
|
2024-09-23 12:50:50 +03:00
|
|
|
|
* @property string slug
|
2024-08-30 16:14:31 +03:00
|
|
|
|
* @method static find($id)
|
|
|
|
|
*/
|
|
|
|
|
|
2024-08-30 12:27:46 +03:00
|
|
|
|
class Menu extends Model
|
|
|
|
|
{
|
2024-09-03 16:29:44 +03:00
|
|
|
|
const DISABLE_STATUS = 0;
|
|
|
|
|
const ACTIVE_STATUS = 1;
|
|
|
|
|
|
2024-08-30 12:27:46 +03:00
|
|
|
|
protected $table = 'menu';
|
2024-09-23 12:50:50 +03:00
|
|
|
|
protected $fillable = ['parent_id', 'icon_file', 'icon_font', 'label', 'url', 'status', 'slug'];
|
2024-08-30 12:27:46 +03:00
|
|
|
|
protected array $dates = ['deleted_at'];
|
|
|
|
|
|
|
|
|
|
public static function labels(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
2024-09-03 17:36:10 +03:00
|
|
|
|
'label' => 'Заголовок',
|
2024-08-30 12:27:46 +03:00
|
|
|
|
'parent_id' => 'Родительский пункт меню',
|
|
|
|
|
'icon_file' => 'Путь к иконке',
|
|
|
|
|
'icon_font' => 'Иконка',
|
|
|
|
|
'url' => 'URL',
|
|
|
|
|
'status' => 'Статус',
|
2024-09-23 12:50:50 +03:00
|
|
|
|
'slug' => 'Slug',
|
2024-08-30 12:27:46 +03:00
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-03 16:29:44 +03:00
|
|
|
|
/**
|
|
|
|
|
* @return string[]
|
|
|
|
|
*/
|
|
|
|
|
public static function getStatus(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
self::DISABLE_STATUS => "Не активный",
|
|
|
|
|
self::ACTIVE_STATUS => "Активный",
|
|
|
|
|
];
|
|
|
|
|
}
|
2024-08-30 12:27:46 +03:00
|
|
|
|
}
|