/**
  * Creates a new Deck model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Deck();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         // link cards
         $cards = Yii::$app->request->post('Deck');
         $cards = $cards['cards'];
         foreach ($cards as $card_form) {
             $card = Card::find()->where(['id' => $card_form])->one();
             $model->link('cards', $card);
         }
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model, 'card_options' => $this->getCardOptions(), 'deck_options' => $this->getParentDeckOptions()]);
     }
 }