public static function getTeamsSolvedTask($task_id) { return AcceptedRequests::find()->joinWith("user")->where(["task_id" => $task_id])->all(); }
/** * Finds the AcceptedRequests model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return AcceptedRequests the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = AcceptedRequests::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function getSolvedTasks() { $tasks = AcceptedRequests::find()->where(['user_id' => $this->id])->all(); $data = []; foreach ($tasks as $task) { $data[$task->task_id] = 1; } return $data; }