2024-09-23 15:33:48 +03:00
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace kernel\modules\option\models;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @property int $id
|
|
|
|
|
* @property string $key
|
|
|
|
|
* @property array|string $value
|
|
|
|
|
* @property string $label
|
|
|
|
|
* @property int $status
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
class Option extends Model
|
|
|
|
|
{
|
2024-09-23 17:03:42 +03:00
|
|
|
|
const DISABLE_STATUS = 0;
|
|
|
|
|
const ACTIVE_STATUS = 1;
|
2024-09-23 15:33:48 +03:00
|
|
|
|
|
|
|
|
|
protected $table = 'option';
|
|
|
|
|
protected $fillable = ['key', 'value', 'label', 'status'];
|
|
|
|
|
protected array $dates = ['created_at', 'updated_at'];
|
|
|
|
|
|
|
|
|
|
public static function labels()
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'key' => 'Ключ',
|
|
|
|
|
'value' => 'Значение',
|
|
|
|
|
'label' => 'Название',
|
|
|
|
|
'status' => 'Статус'
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-23 17:03:42 +03:00
|
|
|
|
/**
|
|
|
|
|
* @return string[]
|
|
|
|
|
*/
|
|
|
|
|
public static function getStatus(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
self::DISABLE_STATUS => "Не активный",
|
|
|
|
|
self::ACTIVE_STATUS => "Активный",
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-23 15:33:48 +03:00
|
|
|
|
}
|