6
0
Fork 0

修改异常抛出方式

release
vine_liutk 2021-11-22 10:41:26 +08:00
parent 919bc097ce
commit dd0b7dca77
1 changed files with 2 additions and 1 deletions

View File

@ -4,6 +4,7 @@ namespace App\Admin\Controllers;
use App\Admin\Actions\Grid\ArticleList;
use App\Admin\Repositories\ArticleCategory;
use App\Exceptions\BizException;
use App\Models\Article;
use App\Models\ArticleCategory as ArticleCategoryModel;
use Dcat\Admin\Admin;
@ -120,7 +121,7 @@ class ArticleCategoryController extends AdminController
//如果有子分类或者分类下有文章则不允许删除
if (ArticleCategoryModel::descendantsOf($id, ['id'])->count() > 0
|| Article::where('category_id', $id)->count() > 0) {
abort(400, __('article-category.options.deny_message'));
throw new BizException(__('article-category.options.deny_message'));
}
return parent::destroy($id);
}