Example #1
0
 /**
  * Creates a new BlackItem model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $username = Yii::$app->user->identity->username;
     $model = new BlackItem();
     if (Yii::$app->request->isPost && ($model = BlackItem::create(Yii::$app->request->post()))) {
         return $this->redirect(['update', 'id' => $model->id]);
     } else {
         return $this->render('create', ['username' => $username, 'model' => $model]);
     }
 }