add resume update method

This commit is contained in:
iIronside
2023-11-22 12:42:36 +03:00
parent 75329a8835
commit 835147af37
5 changed files with 230 additions and 8 deletions

View File

@ -32,17 +32,19 @@ class UserCard extends \common\models\UserCard
public function afterSave($insert, $changedAttributes)
{
$post = Yii::$app->request->post('UserCard');
if (Yii::$app->request->post('UserCard')) {
$post = Yii::$app->request->post('UserCard');
if ($post['skill']) {
CardSkill::deleteAll(['card_id' => $this->id]);
if ($post['skill']) {
CardSkill::deleteAll(['card_id' => $this->id]);
foreach ($post['skill'] as $item) {
$skill = new CardSkill();
$skill->skill_id = $item;
$skill->card_id = $this->id;
foreach ($post['skill'] as $item) {
$skill = new CardSkill();
$skill->skill_id = $item;
$skill->card_id = $this->id;
$skill->save();
$skill->save();
}
}
}