我想在Laravel中的删除语句后检查行是否受到影响。
我的代码:
private function removeUserOutstandingRecord()
{
$query = UserOutstanding::where('o_id', $this->outstanding_id)->delete();
dd($query);
if(!$query) {
Log::error('Could not delete user outstanding record. Outstanding ID given: ' . $this->outstanding_id);
throw new \Exception('Oops.');
}
return true;
}
模具&即使已删除记录,dump也会返回0
。