public function actionEditForum($cid = null, $id = null)
    {
        $model = Forum::find()->where(['id' => $id, 'category_id' => $cid])->limit(1)->one();
        if (empty($model)) {
            $this->error(Yii::t('podium/flash', 'Sorry! We can not find Forum with this ID.'));
            return $this->redirect(['admin/forums', 'cid' => $cid]);
        }
        if ($model->load(Yii::$app->request->post())) {
            if ($model->save()) {
                Log::info('Forum updated', $model->id, __METHOD__);
                $this->success(Yii::t('podium/flash', 'Forum has been updated.'));
                return $this->refresh();
            }
            $this->error(Yii::t('podium/flash', 'Sorry! There was an error while updating the forum.'));
        }
        return $this->render('forum', [
            'model' => $model,
            'forums' => Forum::find()->where(['category_id' => $cid])->orderBy(['sort' => SORT_ASC, 'id' => SORT_ASC])->all(),
            'categories' => Category::find()->orderBy(['sort' => SORT_ASC, 'id' => SORT_ASC])->all()
        ]);
    }
public function actionEditForum($cid = null, $id = null)
    {
        $model = Forum::find()->where(['id' => $id, 'category_id' => $cid])->limit(1)->one();
        if (empty($model)) {
            $this->error(Yii::t('podium/flash', 'Sorry! We can not find Forum with this ID.'));
            return $this->redirect(['admin/forums', 'cid' => $cid]);
        }
        if ($model->load(Yii::$app->request->post())) {
            if ($model->save()) {
                Log::info('Forum updated', $model->id, __METHOD__);
                $this->success(Yii::t('podium/flash', 'Forum has been updated.'));
                return $this->refresh();
            }
            $this->error(Yii::t('podium/flash', 'Sorry! There was an error while updating the forum.'));
        }
        return $this->render('forum', [
            'model' => $model,
            'forums' => Forum::find()->where(['category_id' => $cid])->orderBy(['sort' => SORT_ASC, 'id' => SORT_ASC])->all(),
            'categories' => Category::find()->orderBy(['sort' => SORT_ASC, 'id' => SORT_ASC])->all()
        ]);
    }
public function actionEditForum ( $ cid = null , $ id = null ) { $ model = Forum :: find ( ) -> where ( [ 'id' => $ id , 'category_id' => $ cid ] ) -> limit ( 1 ) -> one ( ) ; if ( empty ( $ model ) ) { $ this -> error ( Yii :: t ( 'podium/flash' , 'Sorry! We can not find Forum with this ID.' ) ) ; return $ this -> redirect ( [ 'admin/forums' , 'cid' => $ cid ] ) ; } if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) ) { if ( $ model -> save ( ) ) { Log :: info ( 'Forum updated' , $ model -> id , __METHOD__ ) ; $ this -> success ( Yii :: t ( 'podium/flash' , 'Forum has been updated.' ) ) ; return $ this -> refresh ( ) ; } $ this -> error ( Yii :: t ( 'podium/flash' , 'Sorry! There was an error while updating the forum.' ) ) ; } return $ this -> render ( 'forum' , [ 'model' => $ model , 'forums' => Forum :: find ( ) -> where ( [ 'category_id' => $ cid ] ) -> orderBy ( [ 'sort' => SORT_ASC , 'id' => SORT_ASC ] ) -> all ( ) , 'categories' => Category :: find ( ) -> orderBy ( [ 'sort' => SORT_ASC , 'id' => SORT_ASC ] ) -> all ( ) ] ) ; }
Editing the forum of given ID.
@param int $cid parent category ID
@param int $id forum ID
@return string|Response
Editing the forum of given ID .