/** * Отображает новые заказы * @return array|\yii\db\ActiveRecord[] * @throws ForbiddenHttpException * @throws NotFoundHttpException */ public function actionNew() { $searchModel = new Order(); if (!Yii::$app->user->can('listModels', array("model" => $searchModel))) { throw new ForbiddenHttpException('Forbidden'); } $searchModel->setScenario(ActiveRecord::SCENARIO_SEARCH); $perm = $searchModel->getPermission(); $status = Status::findOne(["default" => true]); if (!$status) { throw new NotFoundHttpException(); } $query = Order::find()->published()->andWhere(["status_id" => $status->id]); if ($perm) { $perm->applyConstraint($query); } return $query->all(); }