Редактирование skills

This commit is contained in:
Glambertessa
2019-11-18 16:14:06 +03:00
parent 6037c69b85
commit 028cce3bef
9 changed files with 134 additions and 8 deletions

View File

@ -3,11 +3,10 @@
namespace frontend\modules\card\controllers;
use common\classes\Debug;
use common\models\CardSkill;
use common\models\FieldsValueNew;
use Yii;
use common\models\UserCard;
use frontend\modules\card\models\UserCard;
use yii\data\ActiveDataProvider;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
@ -26,7 +25,7 @@ class UserCardController extends Controller
$id_user = Yii::$app->user->id;
$result = UserCard::find()->where(['id_user' => $id_user])->asArray()->all();
if($result){
if($result) {
$id = $result[0]['id'];
$dataProvider = new ActiveDataProvider([
'query' => FieldsValueNew::find()
@ -49,6 +48,25 @@ class UserCardController extends Controller
}
}
/**
* Updates an existing UserCard model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['index', 'id' => $model->id]);
}
return $this->render('update', [
'model' => $model,
]);
}
/**
* Finds the Product model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.