@@ -4,14 +4,14 @@ discard block |
||
4 | 4 | use Illuminate\Support\Carbon; |
5 | 5 | use MongoDB\BSON\UTCDateTime; |
6 | 6 | |
7 | -if (! function_exists('analytics')) { |
|
7 | +if (!function_exists('analytics')) { |
|
8 | 8 | function analytics(): APAnalytics |
9 | 9 | { |
10 | 10 | return app(APAnalytics::class); |
11 | 11 | } |
12 | 12 | } |
13 | 13 | |
14 | -if (! function_exists('trackEvent')) { |
|
14 | +if (!function_exists('trackEvent')) { |
|
15 | 15 | /** |
16 | 16 | * Access event dispatch of event tracker direct. |
17 | 17 | * @param mixed $event |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | } |
27 | 27 | } |
28 | 28 | |
29 | -if (! function_exists('showEvents')) { |
|
29 | +if (!function_exists('showEvents')) { |
|
30 | 30 | /** |
31 | 31 | * Access event dispatch of event tracker direct. |
32 | 32 | * @param mixed $event |
@@ -43,14 +43,14 @@ discard block |
||
43 | 43 | } |
44 | 44 | } |
45 | 45 | |
46 | -if (! function_exists('is_countable')) { |
|
46 | +if (!function_exists('is_countable')) { |
|
47 | 47 | function is_countable($c) |
48 | 48 | { |
49 | 49 | return is_array($c) || $c instanceof Countable; |
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
53 | -if (! function_exists('mongoTime')) { |
|
53 | +if (!function_exists('mongoTime')) { |
|
54 | 54 | /** |
55 | 55 | * Returns time in MongoDb Time. |
56 | 56 | * @param null|mixed $time |
@@ -23,7 +23,7 @@ |
||
23 | 23 | |
24 | 24 | //$this->app->register(APAnalyticsEventServiceProvider::class); |
25 | 25 | |
26 | - $this->app->singleton('apanalytics', function () { |
|
26 | + $this->app->singleton('apanalytics', function() { |
|
27 | 27 | return new APAnalytics(); |
28 | 28 | }); |
29 | 29 | } |
@@ -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 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $intervalFormat = '%Y-%m'; |
112 | 112 | } |
113 | 113 | |
114 | - $aggregate[] = [ |
|
114 | + $aggregate[] = [ |
|
115 | 115 | '$group' => [ |
116 | 116 | '_id' => [ |
117 | 117 | '$dateToString' => ['date' => '$created_at', 'format' => $intervalFormat], |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $aggregate[] = ['$unwind' => '$'.Str::before($groupBy, '.')]; |
144 | 144 | } |
145 | 145 | |
146 | - $aggregate[] = [ |
|
146 | + $aggregate[] = [ |
|
147 | 147 | '$group' => [ |
148 | 148 | '_id' => '$'.$groupBy, |
149 | 149 | 'count' => [ |
@@ -163,8 +163,8 @@ discard block |
||
163 | 163 | ]; |
164 | 164 | } |
165 | 165 | |
166 | - $data = $model::raw(function ($collection) use ($matchArray, $interval, $aggregate, $groupBy) { |
|
167 | - if ($interval == 'count' && ! $groupBy) { |
|
166 | + $data = $model::raw(function($collection) use ($matchArray, $interval, $aggregate, $groupBy) { |
|
167 | + if ($interval == 'count' && !$groupBy) { |
|
168 | 168 | return $collection->count($matchArray); |
169 | 169 | } |
170 | 170 | |
@@ -185,11 +185,11 @@ discard block |
||
185 | 185 | */ |
186 | 186 | private function toModels($data, $model = null) |
187 | 187 | { |
188 | - if (! $model) { |
|
188 | + if (!$model) { |
|
189 | 189 | $model = '\Jenssegers\Mongodb\Eloquent\Model'; |
190 | 190 | } |
191 | 191 | |
192 | - if (! class_exists($model)) { |
|
192 | + if (!class_exists($model)) { |
|
193 | 193 | throw new InvalidArgumentException("Model {$model} does not exist."); |
194 | 194 | } |
195 | 195 | |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | if ($modelId) { |
234 | 234 | $model = $modelClass::find($modelId); |
235 | 235 | |
236 | - if ($model && ! $model->canViewAnalytic($user)) { |
|
236 | + if ($model && !$model->canViewAnalytic($user)) { |
|
237 | 237 | return false; |
238 | 238 | } |
239 | 239 | } |
@@ -43,7 +43,7 @@ |
||
43 | 43 | */ |
44 | 44 | public function broadcastOn() |
45 | 45 | { |
46 | - $postEvent = in_array($this->collection, config('apanalytics.format_collections')); |
|
46 | + $postEvent = in_array($this->collection, config('apanalytics.format_collections')); |
|
47 | 47 | |
48 | 48 | if ($postEvent) { |
49 | 49 | return new PresenceChannel("analytics.{$this->collection}.{$this->basename}.{$this->itemId}"); |
@@ -100,7 +100,7 @@ |
||
100 | 100 | } |
101 | 101 | |
102 | 102 | // Basic created ie user |
103 | - if (! $postEvent) { |
|
103 | + if (!$postEvent) { |
|
104 | 104 | foreach ($items as $item) { |
105 | 105 | $basename = strtolower(Str::singular($collection)); |
106 | 106 | $data = [ |