'yii\rest\IndexAction', 'modelClass' => $this->modelClass, 'dataFilter' => $this->getFilter() ]; return $action; } /** * @return array * @throws InvalidConfigException */ protected function getFilter() { if (empty(Yii::$app->request->getBodyParams())) { Yii::$app->request->setBodyParams(['user' => true]); } $array = ['user_id' => Yii::$app->user->getId()]; $status = Yii::$app->request->getBodyParam('status'); if ($status) { $array['status'] = $status; } return ['class' => 'yii\data\ActiveDataFilter', 'filter' => $array, 'searchModel' => ['class' => 'backend\modules\shop\models\searchs\OrderSearch'] ]; } /** * @return Order * @throws yii\base\Exception * @throws yii\web\BadRequestHttpException */ public function actionCreate() { return $this->object->create(); } /** * @return bool * @throws InvalidConfigException * @throws Throwable * @throws yii\base\Exception * @throws yii\web\BadRequestHttpException * @throws yii\web\NotFoundHttpException * @throws yii\web\ServerErrorHttpException */ public function actionUpdate() { return $this->object->update(); } }