'yii\rest\OptionsAction', 'collectionOptions' => ['DELETE', 'PUT', 'OPTIONS'] ]; return $action; } /** * @return object * @throws yii\base\InvalidConfigException */ public function actionIndex() { $query = Cart::find()->where(['user_id' => Yii::$app->user->getId()]); return Helper::index($query); } /** * @return bool * @throws Throwable * @throws Yii\base\InvalidConfigException * @throws Yii\db\StaleObjectException * @throws yii\base\Exception * @throws yii\web\BadRequestHttpException * @throws yii\web\NotFoundHttpException * @throws yii\web\ServerErrorHttpException */ public function actionUpdate() { return $this->object->update(); } /** * @return null|Cart * @throws yii\base\Exception * @throws yii\web\BadRequestHttpException * @throws yii\web\NotFoundHttpException * @throws yii\web\ServerErrorHttpException */ public function actionCreate() { return $this->object->create(); } /** * @throws Yii\db\StaleObjectException * @throws Throwable * @throws yii\web\BadRequestHttpException * @throws yii\web\NotFoundHttpException * @throws yii\web\ServerErrorHttpException */ public function actionDelete() { return $this->object->delete(); } }