/**
  * Creates a new Forum model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Forum();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
Exemple #2
0
 /**
  * Creates a new Forum model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $this->layout = '@app/modules/user/views/layouts/user';
     $model = new Forum();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->forum_url]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
Exemple #3
0
 /**
  * Creates a new Forum model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $this->layout = '@app/modules/user/views/layouts/user';
     $model = new Forum();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         Yii::$app->getSession()->setFlash('success', Yii::t('app', 'Create successfully.'));
         return $this->redirect(['view', 'id' => $model->forum_url]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
 public function forumInit()
 {
     Console::output('创建默认版块 ....');
     $forum = new Forum();
     $forum->setAttributes(['name' => '默认版块', 'description' => '默认版块描述']);
     if ($forum->save()) {
         $message = '成功';
         $this->forumId = $forum->primaryKey;
     } else {
         $message = '失败';
     }
     Console::output('创建默认版块' . $message);
 }
 public function forumInit()
 {
     echo PHP_EOL . '创建默认版块 ....' . PHP_EOL;
     $forum = new Forum();
     $forum->setAttributes(['name' => '默认版块', 'description' => '默认版块描述']);
     if ($forum->save()) {
         $message = '成功';
         $this->forumId = $forum->primaryKey;
     } else {
         $message = '失败';
     }
     echo PHP_EOL . '创建默认版块' . $message . PHP_EOL;
 }