/** * Creates a new Yorum model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { if (Yii::$app->user->can('yorumekle')) { $model = new Yorum(); $types = ArrayHelper::map(Tip::find()->all(), 'id', 'isim'); if ($model->load(Yii::$app->request->post()) && Yii::$app->user->getId() != null) { $model->yazan = Yii::$app->user->getId(); if ($model->save()) { return $this->redirect(['view', 'id' => $model->id]); } } else { return $this->render('create', ['model' => $model, 'types' => $types]); } } else { Yii::$app->session->setFlash('error', 'İçerik oluşturma yetkiniz yok'); $this->redirect(['index']); } }