Commit 2cda8b9d08f60c25e19b0c861c28b96d1f7eb323
1 parent
8c1ac2ba
ga output
Showing
1 changed file
with
2 additions
and
2 deletions
Show diff stats
app/library/App/Controllers/GaController.php
| ... | ... | @@ -36,9 +36,11 @@ class GaController extends CrudResourceController { |
| 36 | 36 | $get_end_date = $this->request->get('end') ?? 'today'; |
| 37 | 37 | |
| 38 | 38 | if (empty($view_id)) { |
| 39 | + $result = []; | |
| 39 | 40 | $projects = Project::find(['user_id' => $user_id]); |
| 40 | 41 | foreach ($projects as $project) { |
| 41 | 42 | $view_id = (string)$project->ga_view_id; |
| 43 | + $result['name'] = $project->name; | |
| 42 | 44 | $result[] = $this->sendGaRequest($view_id, $get_metrics, $get_dimensions, $get_start_date, $get_end_date); |
| 43 | 45 | } |
| 44 | 46 | } |
| ... | ... | @@ -134,8 +136,6 @@ class GaController extends CrudResourceController { |
| 134 | 136 | $response = $response->reports[0]['data']['rows']; |
| 135 | 137 | |
| 136 | 138 | $result = []; |
| 137 | - $project = Project::findFirst(['ga_view_id' => $view]); | |
| 138 | - $result['name'] = $project->name; | |
| 139 | 139 | |
| 140 | 140 | foreach ($response as $item) { |
| 141 | 141 | ... | ... |