Completed
Branch master (40186e)
by bader
02:33 queued 18s
created
src/Visits.php 1 patch
Spacing   +7 added lines, -8 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      */
67 67
     public function __get($attribute)
68 68
     {
69
-        if($this->keys->instanceOfModel && $relation = $this->subject->$attribute) {
69
+        if ($this->keys->instanceOfModel && $relation = $this->subject->$attribute) {
70 70
             $this->keys->append($attribute, $relation->{$relation->getKeyName()});
71 71
         }
72 72
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      */
80 80
     public function by($subject)
81 81
     {
82
-        if($subject instanceof Model) {
82
+        if ($subject instanceof Model) {
83 83
             $this->keys->append(strtolower(str_singular(class_basename(get_class($subject)))),
84 84
                 $subject->{$subject->getKeyName()});
85 85
         } else if (is_array($subject)) {
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
         $cachedList = $this->cachedList($limit, $cacheKey);
235 235
         $cachedIds = $cachedList->pluck('id')->toArray();
236 236
 
237
-        if($visitsIds === $cachedIds && ! $this->fresh) {
237
+        if ($visitsIds === $cachedIds && !$this->fresh) {
238 238
             return $cachedList;
239 239
         }
240 240
 
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
         $ip = request()->ip();
293 293
         $key = $this->keys->ip($ip);
294 294
 
295
-        return ! $this->redis->set($key, true, 'EX', $this->ipSeconds, 'NX');
295
+        return !$this->redis->set($key, true, 'EX', $this->ipSeconds, 'NX');
296 296
     }
297 297
 
298 298
     /**
@@ -311,8 +311,7 @@  discard block
 block discarded – undo
311 311
 
312 312
         return intval(
313 313
             (!$this->keys->instanceOfModel) ?
314
-                $this->redis->get($this->keys->visits . '_total') :
315
-                $this->redis->zscore($this->keys->visits, $this->keys->id)
314
+                $this->redis->get($this->keys->visits . '_total') : $this->redis->zscore($this->keys->visits, $this->keys->id)
316 315
         );
317 316
     }
318 317
 
@@ -423,9 +422,9 @@  discard block
 block discarded – undo
423 422
 
424 423
             return ($this->subject)::whereIn($this->keys->primary, $visitsIds)
425 424
                 ->get()
426
-                ->sortBy(function ($subject) use ($visitsIds) {
425
+                ->sortBy(function($subject) use ($visitsIds) {
427 426
                     return array_search($subject->{$this->keys->primary}, $visitsIds);
428
-                })->each(function ($subject) use ($cacheKey) {
427
+                })->each(function($subject) use ($cacheKey) {
429 428
                     $this->redis->rpush($cacheKey, serialize($subject));
430 429
                 });
431 430
         }
Please login to merge, or discard this patch.