/** * Return stat summary for all scheduled games for passed player * @param Integer $player_id * @return array * @throws \Exception */ public function actionIndex($player_id) { $player = Yii::$app->user->getIdentity(false); if ($player_id != $player->id) { throw new \yii\web\HttpException(400); } $dashboard = new Dashboard(); return $dashboard->getPlayerGamesDashboardData(); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Dashboard::find(); // add conditions that should always apply here $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } // grid filtering conditions $query->andFilterWhere(['id' => $this->id, 'value' => $this->value, 'date' => $this->date, 'is_pending' => $this->is_pending, 'inc_datetime' => $this->inc_datetime, 'edit_datetime' => $this->edit_datetime, 'user_id' => $this->user_id, 'category_id' => $this->category_id, 'type_id' => $this->type_id]); $query->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'attachment', $this->attachment]); return $dataProvider; }
protected function findModel($id) { if (($model = Dashboard::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }