1
This commit is contained in:
29
app/common/model/ArticleCates.php
Normal file
29
app/common/model/ArticleCates.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use think\model\relation\HasMany;
|
||||
|
||||
class ArticleCates extends TimeModel
|
||||
{
|
||||
protected array $rule = [
|
||||
'title' => 'require|max:50|unique:article_cates',
|
||||
'sort' => 'integer|egt:0',
|
||||
'status' => 'in:0,1'
|
||||
];
|
||||
|
||||
protected array $message = [
|
||||
'title.require' => '分类名称不能为空',
|
||||
'title.max' => '分类名称最多50个字符',
|
||||
'title.unique' => '分类名称已存在',
|
||||
'sort.integer' => '排序必须为整数',
|
||||
'sort.egt' => '排序不能小于0',
|
||||
'status.in' => '状态值错误'
|
||||
];
|
||||
|
||||
public function articles(): HasMany
|
||||
{
|
||||
return $this->hasMany(Articles::class, 'cate_id');
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user