I'm trying to run the following query:
CompetitionMatch::where('competition_id', $competition->id)->where('id', $match->id)->update(['posted_at' => Carbon::now()]);
But I get the following error:
SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens (SQL: update `competition_matches` set `posted_at` = 2017-09-10 22:02:11 where `competition_id` = App\CompetitionMatch and `id` = 1)
From inspecting the error I can see that 'App\CompetitionMatch' gets added to the list of parameters for some reason:
'update `competition_matches` set `posted_at` = ? where `competition_id` = ? and `id` = ?', array(object(Carbon), 'App\\CompetitionMatch', 1, 14
The first parameter is Carbon::now(). The last two (1, 14) are my competition and match id's. But why is it adding the 'App\CompetitionMatch' as a second parameter? There's literally no reason for this to be happening.