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