/** * Creates a new Bookcategory model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Bookcategory(); $model->attributes = Yii::$app->request->post(); if ($model->save()) { return ['error' => false, 'data' => $model]; //return $model; } else { return ['error' => true, 'data' => $model->errors]; //return $model->errors; } }