Laravel-admin 模型表格 删除行,删除回调
在对应模型中增加
protected static function booted()
{
static::deleting(function ($_it) {
$total = 1; //在这里去做逻辑判断,$_it->id 可以拿到当前操作id
if ($total > 0) {
throw new \Exception("无法删除");
}
return true;
});
}
最近访问时间:2025-04-29 13:26:08