@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $aggregate = []; |
69 | 69 | $model = $this->namespace.Str::studly(Str::singular($collection)).'Analytic'; |
70 | 70 | |
71 | - if (! class_exists($model)) { |
|
71 | + if (!class_exists($model)) { |
|
72 | 72 | throw new InvalidArgumentException("Model {$model} does not exist."); |
73 | 73 | } |
74 | 74 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
91 | - if (! app()->runningInConsole()) { |
|
91 | + if (!app()->runningInConsole()) { |
|
92 | 92 | abort_unless(auth()->check() && $this->canViewAnalytic($model, $matchArray, auth()->user()), 403, 'You dont have permission to view these analytics'); |
93 | 93 | } |
94 | 94 | if ($start) { |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $intervalFormat = '%Y-%m'; |
117 | 117 | } |
118 | 118 | |
119 | - $aggregate[] = [ |
|
119 | + $aggregate[] = [ |
|
120 | 120 | '$group' => [ |
121 | 121 | '_id' => [ |
122 | 122 | '$dateToString' => ['date' => '$created_at', 'format' => $intervalFormat], |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $aggregate[] = ['$unwind' => '$'.Str::before($groupBy, '.')]; |
149 | 149 | } |
150 | 150 | |
151 | - $aggregate[] = [ |
|
151 | + $aggregate[] = [ |
|
152 | 152 | '$group' => [ |
153 | 153 | '_id' => '$'.$groupBy, |
154 | 154 | 'count' => [ |
@@ -168,8 +168,8 @@ discard block |
||
168 | 168 | ]; |
169 | 169 | } |
170 | 170 | |
171 | - $data = $model::raw(function ($collection) use ($matchArray, $interval, $aggregate, $groupBy) { |
|
172 | - if ($interval == 'count' && ! $groupBy) { |
|
171 | + $data = $model::raw(function($collection) use ($matchArray, $interval, $aggregate, $groupBy) { |
|
172 | + if ($interval == 'count' && !$groupBy) { |
|
173 | 173 | return $collection->count($matchArray); |
174 | 174 | } |
175 | 175 | |
@@ -190,11 +190,11 @@ discard block |
||
190 | 190 | */ |
191 | 191 | private function toModels($data, $model = null) |
192 | 192 | { |
193 | - if (! $model) { |
|
193 | + if (!$model) { |
|
194 | 194 | $model = '\Jenssegers\Mongodb\Eloquent\Model'; |
195 | 195 | } |
196 | 196 | |
197 | - if (! class_exists($model)) { |
|
197 | + if (!class_exists($model)) { |
|
198 | 198 | throw new InvalidArgumentException("Model {$model} does not exist."); |
199 | 199 | } |
200 | 200 | |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | if ($modelId) { |
239 | 239 | $model = $modelClass::find($modelId); |
240 | 240 | |
241 | - if ($model && ! $model->canViewAnalytic($user)) { |
|
241 | + if ($model && !$model->canViewAnalytic($user)) { |
|
242 | 242 | return false; |
243 | 243 | } |
244 | 244 | } |