在Laravel 5.5中save()返回true

时间:2018-09-25 09:35:22

标签: php laravel-5.5

现在,我要保存一个模型。

代码:

//I have a lot of tables
//tables :day_01,day_02,day_03....day_31;
$objData = $objModel->setTable("day_01")->where(['user_id'=>123])->first();
$intNum = $objData->num;
//I made a mistake specifically. table `day_02` don't have user_id=123 data
$objData->setTable("day_02");
$objData->num = $intNum+20; 
$isRs = $objData->save();
dd($isRs)//true,this is a mistake.it didn't change data

所以现在,即使没有更改数据,我如何检查save()是否成功?

sql: //DB::listen select * from day_01 where ( user_id = '123') limit 1 ; update day_02 set num = '20' where user_id = 123;

0 个答案:

没有答案