@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | ->connect($this->config['connection']) |
82 | 82 | ->setPrefix($this->config['keys_prefix'] ?? $this->config['redis_keys_prefix'] ?? 'visits'); |
83 | 83 | |
84 | - if(! $this->connection) { |
|
84 | + if (!$this->connection) { |
|
85 | 85 | return; |
86 | 86 | } |
87 | 87 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $this->subject = $subject; |
94 | 94 | $this->keys = new Keys($subject, preg_replace('/[^a-z0-9_]/i', '', $tag)); |
95 | 95 | |
96 | - if (! empty($this->keys->id)) { |
|
96 | + if (!empty($this->keys->id)) { |
|
97 | 97 | $this->periodsSync(); |
98 | 98 | } |
99 | 99 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | 'eloquent' => \Awssat\Visits\DataEngines\EloquentEngine::class |
106 | 106 | ]; |
107 | 107 | |
108 | - if(! array_key_exists($name, $connections)) { |
|
108 | + if (!array_key_exists($name, $connections)) { |
|
109 | 109 | throw new \Exception("(Laravel-Visits) The selected engine `{$name}` is not supported! Please correct this issue from config/visits.php."); |
110 | 110 | } |
111 | 111 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function by($subject) |
120 | 120 | { |
121 | - if($subject instanceof Model) { |
|
121 | + if ($subject instanceof Model) { |
|
122 | 122 | $this->keys->append($this->keys->modelName($subject), $subject->{$subject->getKeyName()}); |
123 | 123 | } else if (is_array($subject)) { |
124 | 124 | $this->keys->append(array_keys($subject)[0], Arr::first($subject)); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | */ |
146 | 146 | public function recordedIp() |
147 | 147 | { |
148 | - if(! $this->connection->exists($this->keys->ip(request()->ip()))) { |
|
148 | + if (!$this->connection->exists($this->keys->ip(request()->ip()))) { |
|
149 | 149 | $this->connection->set($this->keys->ip(request()->ip()), true); |
150 | 150 | $this->connection->setExpiration($this->keys->ip(request()->ip()), $this->ipSeconds); |
151 | 151 | |
@@ -162,13 +162,13 @@ discard block |
||
162 | 162 | public function count() |
163 | 163 | { |
164 | 164 | if ($this->country) { |
165 | - return $this->connection->get($this->keys->visits."_countries:{$this->keys->id}", $this->country); |
|
165 | + return $this->connection->get($this->keys->visits . "_countries:{$this->keys->id}", $this->country); |
|
166 | 166 | } else if ($this->referer) { |
167 | - return $this->connection->get($this->keys->visits."_referers:{$this->keys->id}", $this->referer); |
|
167 | + return $this->connection->get($this->keys->visits . "_referers:{$this->keys->id}", $this->referer); |
|
168 | 168 | } else if ($this->operatingSystem) { |
169 | - return $this->connection->get($this->keys->visits."_OSes:{$this->keys->id}", $this->operatingSystem); |
|
169 | + return $this->connection->get($this->keys->visits . "_OSes:{$this->keys->id}", $this->operatingSystem); |
|
170 | 170 | } else if ($this->language) { |
171 | - return $this->connection->get($this->keys->visits."_languages:{$this->keys->id}", $this->language); |
|
171 | + return $this->connection->get($this->keys->visits . "_languages:{$this->keys->id}", $this->language); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | return intval( |
@@ -212,14 +212,14 @@ discard block |
||
212 | 212 | $this->connection->increment($this->keys->visits, $inc, $this->keys->id); |
213 | 213 | $this->connection->increment($this->keys->visitsTotal(), $inc); |
214 | 214 | |
215 | - if(is_array($this->globalIgnore) && sizeof($this->globalIgnore) > 0) { |
|
215 | + if (is_array($this->globalIgnore) && sizeof($this->globalIgnore) > 0) { |
|
216 | 216 | $ignore = array_merge($ignore, $this->globalIgnore); |
217 | 217 | } |
218 | 218 | |
219 | 219 | //NOTE: $$method is parameter also .. ($periods,$country,$refer) |
220 | 220 | foreach (['country', 'refer', 'periods', 'operatingSystem', 'language'] as $method) { |
221 | - if(! in_array($method, $ignore)) { |
|
222 | - $this->{'record'.Str::studly($method)}($inc); |
|
221 | + if (!in_array($method, $ignore)) { |
|
222 | + $this->{'record' . Str::studly($method)}($inc); |
|
223 | 223 | } |
224 | 224 | } |
225 | 225 | |
@@ -280,6 +280,6 @@ discard block |
||
280 | 280 | { |
281 | 281 | $prefix = $this->config['keys_prefix'] ?? $this->config['redis_keys_prefix'] ?? 'visits'; |
282 | 282 | |
283 | - return $this->subject->hasOne(Visit::class, 'secondary_key')->where('primary_key', $prefix.':'.$this->keys->visits); |
|
283 | + return $this->subject->hasOne(Visit::class, 'secondary_key')->where('primary_key', $prefix . ':' . $this->keys->visits); |
|
284 | 284 | } |
285 | 285 | } |