f5e93f2400
# Conflicts: # app/admin/service/SysDictService.php
58 lines
1.1 KiB
PHP
58 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace app\common\model;
|
|
|
|
use support\Model;
|
|
|
|
class SysDictCategory extends Model
|
|
{
|
|
/**
|
|
* The connection name for the model.
|
|
*
|
|
* @var string|null
|
|
*/
|
|
protected $connection = 'mysql';
|
|
|
|
/**
|
|
* The table associated with the model.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $table = 'sys_dict_category';
|
|
|
|
/**
|
|
* The primary key associated with the table.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $primaryKey = 'id';
|
|
|
|
/**
|
|
* Indicates if the model should be timestamped.
|
|
*
|
|
* @var bool
|
|
*/
|
|
public $timestamps = true;
|
|
|
|
|
|
protected $dateFormat = 'U';
|
|
|
|
/**
|
|
* 允许自动填充模型字段
|
|
*/
|
|
protected $fillable = ['id', 'category_name', 'sort', 'status', 'created_at', 'updated_at'];
|
|
|
|
/**
|
|
* 不允许自动填充模型字段
|
|
*/
|
|
protected $guarded = [];
|
|
|
|
|
|
public function dicts()
|
|
{
|
|
return $this->hasMany(SysDict::class, 'category_id', 'id')
|
|
->where('status', 1)
|
|
->whereNull('deleted_at')
|
|
->orderBy('id', 'asc');
|
|
}
|
|
} |