Hi my database structure is as follows:
Table: analytics
id | user_id(fk) | date | finalized(boolean)
Now I want to update the data in bulk. For example I want to select the data of user_id = 1 and date BETWEEN 2016-03-01 and 2016-03-20. And then I want to update the column finalized from 0 to 1 for all those records which I get in result.
What I had done is as follows:
Analytics::where('user_id', $request->get('user_id'))
->whereBetween('date', [$request->get('from_date'), $request->get('to_date')])
->update(array('finalized' => 1));
But this is not working and not showing any error either. Please let know how can I do with the help of eloquent. Thanks in advance.
I have seen other questions in Stackover Flow too, but the answer suggests to run foreach loop, which I don't want. So is there any way, then kindly suggest me. Thanks again