All of my data are stored on a multidimensional array and I want to use laravel update with only one line of code without using any loop on every update.
If there is a code like this when inserting multiple data in laravel.
$applicants_insert_data = [[
'id' => 1,
'name' => 'sample1',
'contact' => '09123456789',
'email' => [email protected],
],[
'id' => 1,
'name' => 'sample2',
'contact' => '09987654321',
'email' => [email protected],
]];
applicants::insert($applicants_insert_data);
Is it possible or any way that I can use that kind of method in updating my data?
like this:
$applicants_update_data = [[
'name' => 'sample1',
'contact' => '09123456789',
'email' => [email protected],
],[
'name' => 'sample2',
'contact' => '09987654321',
'email' => [email protected],
]];
$applicants_id = [[
'id' => 1
],[
'id' => 2,
]];
applicants::find($applicants_id)->update($applicants_update_data);