Merge pull request #61 from q6q9/API_reports

Api reports
This commit is contained in:
apuc authored and GitHub committed 2021-09-14 13:49:45 +03:00
commit 724a287a5e
2 files changed
+16 -5

No files matched your search

@@ -39,13 +39,12 @@ class ReportSearchForm extends Model
{
$queryBuilder = Reports::find()
->with('task')
->andWhere(['between', 'reports.created_at', $this->fromDate, $this->toDate, $this->user_id])
->andWhere(['between', 'reports.created_at', $this->fromDate, $this->toDate])
->limit($this->limit)
->offset($this->offset);
if(isset($this->user_id)) {
$userCardId = UserCard::findByUserId($this->user_id)->id;
$queryBuilder->andWhere(['user_card_id' => $userCardId]);
$queryBuilder->andWhere(['user_card_id' => $this->user_id]);
}
$data = $queryBuilder->asArray()->all();