I have model for
The admin adds all the users and sections
This is HABTM relation, first of all you need have relation setup in SectionUser
model. Then you can use saveAll()
method to save all records at once.
Array
(
[0] => Array
(
[user_id] => 33
[section_id] => 9
)
[1] => Array
(
[user_id] => 33
[section_id] => 10
)
)
Make sure your data array is in above given format.
$this->SectionUser->saveAll($data);