38 lines
839 B
PHP
38 lines
839 B
PHP
<?php
|
|
declare (strict_types = 1);
|
|
|
|
namespace app\admin\model\v1;
|
|
|
|
use app\common\model\AttachmentCategoryBaseModel;
|
|
use think\model\concern\SoftDelete;
|
|
|
|
/**
|
|
* 附件(下载管理)分类模型
|
|
* @mixin \think\Model
|
|
*/
|
|
class AttachmentCategoryModel extends AttachmentCategoryBaseModel
|
|
{
|
|
// 启用软删除
|
|
use SoftDelete;
|
|
// 软删除字段
|
|
protected $deleteTime = 'deleted_at';
|
|
|
|
// 关联附件
|
|
public function attachment()
|
|
{
|
|
return $this->hasMany(AttachmentModel::class, 'category_id', 'id');
|
|
}
|
|
|
|
// 语言查询
|
|
public function scopeLanguage($query, $value)
|
|
{
|
|
$query->where('language_id', '=', $value);
|
|
}
|
|
|
|
// 查询显示状态数据
|
|
public function scopeIsShow($query, bool $value = true)
|
|
{
|
|
$query->where('is_show', '=', (int)$value);
|
|
}
|
|
}
|