在模型中增加
protected static function booted(){ static::deleting(function ($_it) { $total = 1; //在这里去做逻辑判断,$_it->id 可以拿到当前操作id if ($total > 0) { throw new \Exception("无法删除"); } return true; });}
Laravel-admin 模型表格 删除行,删除回调
原文:https://www.cnblogs.com/ly-y/p/14362436.html