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
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!