modules/admin/controllers/SizeController.php
/**
     * Creates a new Sizes model.
     * If creation is successful, the browser will be redirected to the 'view' page.
     * @return mixed
     */
Creates a new Sizes model.
If creation is successful, the browser will be redirected to the 'view' page.
@return mixed
Creates a new Sizes model . If creation is successful the browser will be redirected to the ' view ' page . @return mixed
public function actionCreate()
    {
        $model = new Sizes();
        $productCategories = ArrayHelper::map(ProductCategory::find()->where(['parent_category_id' => null])->all(), 'id', 'name');
        if ($model->load(Yii::$app->request->post()) && $model->validate()) {
            if ($model->save()) {
                Yii::$app->session->setFlash(Growl::TYPE_SUCCESS, "Size created successfully.");
            } else {
                Yii::$app->session->setFlash(Growl::TYPE_DANGER, "Error while creating Size.");
            }
            return $this->redirect(['index']);
        }
        return $this->render('create', [
            'model' => $model,
            'productCategories' => $productCategories
        ]);
    }
public function actionCreate ( ) { $ model = new Sizes ( ) ; $ productCategories = ArrayHelper :: map ( ProductCategory :: find ( ) -> where ( [ 'parent_category_id' => null ] ) -> all ( ) , 'id' , 'name' ) ; if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) && $ model -> validate ( ) ) { if ( $ model -> save ( ) ) { Yii :: $ app -> session -> setFlash ( Growl :: TYPE_SUCCESS , " Size created successfully. " ) ; } else { Yii :: $ app -> session -> setFlash ( Growl :: TYPE_DANGER , " Error while creating Size. " ) ; } return $ this -> redirect ( [ 'index' ] ) ; } return $ this -> render ( 'create' , [ 'model' => $ model , 'productCategories' => $ productCategories ] ) ; }
Creates a new Sizes model.
Creates a new Sizes model .