So at work we are exclusively Mysql, and I want to take advantage of the "Insert...on duplicate key update" syntax with multiple value sets per statement. For example a raw sql statement might look like:
INSERT INTO sections (`campus`,`term`,`department`,`course`,`section`,`instructor`,`est_enrollment`,`act_enrollment`,`comment`,`b_delete`,`enabled`)
VALUES
(ABC - TRADITIONAL,2015A,DM,DM171,01,June, yost,1,1,2015/01/05 - 2015/01/23,0,'1'),
(ABC - TRADITIONAL,2015AB,DM,DM174,01,bernie, Abe,0,0,2015/01/05 - 2015/01/23,0,'1')
ON DUPLICATE KEY UPDATE `campus`=VALUES(`campus`),`term`=VALUES(`term`),`department`=VALUES(`department`),`course`=VALUES(`course`),`section`=VALUES(`section`),`instructor`=VALUES(`instructor`),`est_enrollment`=VALUES(`est_enrollment`),`act_enrollment`=VALUES(`act_enrollment`),`comment`=VALUES(`comment`),`b_delete`=VALUES(`b_delete`),`enabled`=VALUES(`enabled`)
There is a huge speed advantage to doing this when importing massive csv files. You can see the code I currently have working. The only problem with this approach is that there's no nice way to update relations on models when using the "insertOrUpdate()" function I created.
Is there a way to extend Eloquent in such a way that I could take advantage of the way relations currently work? Secondarily, is there a different approach I should be taking?