@@ -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 | } |
@@ -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 && $collection != 'visits') { |
|
103 | + if (!$postEvent && $collection != 'visits') { |
|
104 | 104 | foreach ($items as $item) { |
105 | 105 | $basename = strtolower(Str::singular($collection)); |
106 | 106 | $data = [ |
@@ -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 |
@@ -44,14 +44,14 @@ discard block |
||
44 | 44 | } |
45 | 45 | } |
46 | 46 | |
47 | -if (! function_exists('is_countable')) { |
|
47 | +if (!function_exists('is_countable')) { |
|
48 | 48 | function is_countable($c) |
49 | 49 | { |
50 | 50 | return is_array($c) || $c instanceof Countable; |
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
54 | -if (! function_exists('mongoTime')) { |
|
54 | +if (!function_exists('mongoTime')) { |
|
55 | 55 | /** |
56 | 56 | * Returns time in MongoDb Time. |
57 | 57 | * @param null|mixed $time |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
67 | -if (! function_exists('valid_json')) { |
|
67 | +if (!function_exists('valid_json')) { |
|
68 | 68 | function valid_json($value) |
69 | 69 | { |
70 | - if (! is_string($value)) { |
|
70 | + if (!is_string($value)) { |
|
71 | 71 | return false; |
72 | 72 | } |
73 | 73 |
@@ -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 | } |