public function actionNewCategory()
    {
        $model = new Category();
        $model->visible = 1;
        $model->sort = 0;
        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            Log::info('Category added', $model->id, __METHOD__);
            $this->success(Yii::t('podium/flash', 'New category has been created.'));
            return $this->redirect(['admin/categories']);
        }
        return $this->render('category', [
            'model' => $model,
            'categories' => Category::find()->orderBy(['sort' => SORT_ASC, 'id' => SORT_ASC])->all()
        ]);
    }
public function actionNewCategory()
    {
        $model = new Category();
        $model->visible = 1;
        $model->sort = 0;
        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            Log::info('Category added', $model->id, __METHOD__);
            $this->success(Yii::t('podium/flash', 'New category has been created.'));
            return $this->redirect(['admin/categories']);
        }
        return $this->render('category', [
            'model' => $model,
            'categories' => Category::find()->orderBy(['sort' => SORT_ASC, 'id' => SORT_ASC])->all()
        ]);
    }
public function actionNewCategory ( ) { $ model = new Category ( ) ; $ model -> visible = 1 ; $ model -> sort = 0 ; if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) && $ model -> save ( ) ) { Log :: info ( 'Category added' , $ model -> id , __METHOD__ ) ; $ this -> success ( Yii :: t ( 'podium/flash' , 'New category has been created.' ) ) ; return $ this -> redirect ( [ 'admin/categories' ] ) ; } return $ this -> render ( 'category' , [ 'model' => $ model , 'categories' => Category :: find ( ) -> orderBy ( [ 'sort' => SORT_ASC , 'id' => SORT_ASC ] ) -> all ( ) ] ) ; }
Adding new category.
@return string|Response
Adding new category .