|
@@ -77,6 +77,10 @@ class CategoryService extends BaseService
|
|
|
{
|
|
|
$category = Category::findOrFail($params['id']);
|
|
|
|
|
|
+ if ($category->level == 1) {
|
|
|
+ throw new ClientException("一级类目不能删除");
|
|
|
+ }
|
|
|
+
|
|
|
if ($count = Category::where("parent_id", $category->id)->count() > 0) {
|
|
|
throw new ClientException("该类目下还有{$count}个子分类,请先删除子类目");
|
|
|
}
|