Update
parent
4117e4796b
commit
c2c877ff2f
|
|
@ -3,6 +3,8 @@
|
|||
namespace App\Admin\Controllers;
|
||||
|
||||
use App\Admin\Repositories\OfflineProductCategory as OfflineProductCategoryRepository;
|
||||
use App\Exceptions\BizException;
|
||||
use App\Models\OfflineOrderItem;
|
||||
use Dcat\Admin\Admin;
|
||||
use Dcat\Admin\Form;
|
||||
use Dcat\Admin\Grid;
|
||||
|
|
@ -11,6 +13,15 @@ use Dcat\Admin\Http\Controllers\AdminController;
|
|||
|
||||
class OfflineProductCategoryController extends AdminController
|
||||
{
|
||||
public function destroy($id)
|
||||
{
|
||||
if (OfflineOrderItem::where('product_category_id', $id)->exists()) {
|
||||
throw new BizException('商品分类已使用');
|
||||
}
|
||||
|
||||
return $this->form()->destroy($id);
|
||||
}
|
||||
|
||||
protected function grid()
|
||||
{
|
||||
return Grid::make(new OfflineProductCategoryRepository(), function (Grid $grid) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue