在对应模型中增加
protected static function booted() { static::deleting(function ($_it) { $total = 1; //在这里去做逻辑判断,$_it->id 可以拿到当前操作id if ($total > 0) { throw new \Exception("无法删除"); } return true; }); }