Array
(
[_csrf] => qnYUAkGxGhaYr3YRe_7_4yNXGlu2tyJGbZYQMUKQ5FfipBcbn9fgdih1408mNVhw==
[Flora] => Array
(
[name] => имя
[geo] => 57.52882177271644, 54.42373046875001
[date] => 2017-09-14
[description] =>
[storage_id] => 1
[users] => Array
(
[0] => 1
[1] => 2
)
[user_id] => 1
[taxon_id] => undefined
)
[Foto] => Array
(
[file] => Array
(
[0] =>
)
)
)
if(i == 'files'){
formData.append(item.name, item);
alert('ok');
}
public function save($runValidation = true, $attributeNames = null)
{
if ($this->getIsNewRecord()) {
return $this->insert($runValidation, $attributeNames);
} else {
return $this->update($runValidation, $attributeNames) !== false;
}
}
$floraUser = new floraUser();
$users = Yii::$app->request->post('Flora')['users'];
foreach ($users as $user) {
$floraUser->isNewRecord = true;
$floraUser->flora_id = $id;
$floraUser->user_id = $user;
$floraUser->save();
}