refactor: 视频分类删除检查分类下是否存在视频

This commit is contained in:
2025-02-21 09:40:50 +08:00
parent 19dc561a67
commit b5443d8e64
2 changed files with 11 additions and 0 deletions

View File

@@ -11,6 +11,12 @@ use app\common\model\VideoCategoryBaseModel;
*/
class VideoCategoryModel extends VideoCategoryBaseModel
{
// 关联视频模型
public function video()
{
return $this->hasMany(VideoModel::class, 'category_id', 'id');
}
// 分类名称搜索
public function searchNameAttr($query, $value)
{