Well, this question is related to installing Laravel 4.1.23. I am trying to update multiple records using the Eloquent update () method in a query that includes a connection:
ChildSchoolYear::whereNull('exit_date')-> join('school_years', 'child_school_years.school_year_id','=','school_years.id')-> update(array('child_school_years.exit_date'=>'`school_years`.`end_date`', 'child_school_years.editor_id'=>$userId))
Laravel generates the correct SQL for the contents of the query, which I provide above, but the generated full SQL statement
update `child_school_years` inner join `school_years` on `child_school_years`.`school_year_id` = `school_years`.`id` set `child_school_years`.`exit_date` = `school_years`.`end_date`, `child_school_years`.`editor_id` = 2, `updated_at` = 2014-08-15 02:00:33 where `exit_date` is null)
This will work, except that the automatically added updated_at field exists in the child_school_years and school_years tables, so adding a Laravel field throws an Integrity constraint violation: 1052 Column 'updated_at' in field list is ambiguous exception Integrity constraint violation: 1052 Column 'updated_at' in field list is ambiguous .
Any suggestions on how to domesticate the updated part? I would be happy if the field was updated, but I will live without it, if necessary, if I can eliminate it.
source share