错误: “数组到字符串的转换(SQL:更新
spent_times
设置updated_at
= 2018-10-23 09:16:43,spent_time
= 16,percentage
= 70,{{ 1}} =测试task_category
= 1)◀“
id
为什么只有第一个ID?
答案 0 :(得分:0)
public static function findOrCreate($plan_id, $data)
{
$spent_time = static::where('plan_id', $plan_id)->first();
$task_category = $spent_time->task_category;
if (is_null($spent_time)) {
return static::create($data);
}else{
$spent_time['spent_time'] = $spent_time->spent_time + $spent_time->daily_spent_time;
$spent_time['percentage'] = $spent_time->percentage + $spent_time->daily_percentage;
return $spent_time->update($data);
}
}