删除数据时需要用户进行一次 confirm , That's it !
$suite = Suite::findOrFail($id);
return Lego::confirm(
"确认删除公寓 {$suite->address} ?",
function () {
$suite->delete();
return redirect(...);
}
)
return Lego::confirm(
"确认删除公寓 {$suite->address} ?",
function ($sure) {
if ($sure) {
$suite->delete();
return redirect(...);
} else {
// do something.
}
}
)
return Lego::confirm(
"确认删除公寓 {$suite->address} ?",
function () {
$suite->delete();
return redirect(...);
},
3
)