@@ -58,11 +58,11 @@ |
||
| 58 | 58 | */ |
| 59 | 59 | protected function xHoursPeriod($period) |
| 60 | 60 | { |
| 61 | - return collect(range(1, 12))->map(function ($hour) { |
|
| 61 | + return collect(range(1, 12))->map(function($hour) { |
|
| 62 | 62 | return ['method' => $hour . 'hours', 'hours' => $hour]; |
| 63 | 63 | })->where('method', $period) |
| 64 | 64 | ->pluck('hours') |
| 65 | - ->map(function ($hours) { |
|
| 65 | + ->map(function($hours) { |
|
| 66 | 66 | return Carbon::now()->endOfxHours($hours); |
| 67 | 67 | }) |
| 68 | 68 | ->first(); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | public function by($subject) |
| 79 | 79 | { |
| 80 | - if($subject instanceof Model) { |
|
| 80 | + if ($subject instanceof Model) { |
|
| 81 | 81 | $this->keys->append($this->keys->modelName($subject), $subject->{$subject->getKeyName()}); |
| 82 | 82 | } else if (is_array($subject)) { |
| 83 | 83 | $this->keys->append(array_keys($subject)[0], array_first($subject)); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | public function recordedIp() |
| 108 | 108 | { |
| 109 | - return ! $this->redis->set($this->keys->ip(request()->ip()), true, 'EX', $this->ipSeconds, 'NX'); |
|
| 109 | + return !$this->redis->set($this->keys->ip(request()->ip()), true, 'EX', $this->ipSeconds, 'NX'); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /** |
@@ -125,8 +125,7 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | return intval( |
| 127 | 127 | (!$this->keys->instanceOfModel) ? |
| 128 | - $this->redis->get($this->keys->visits . '_total') : |
|
| 129 | - $this->redis->zscore($this->keys->visits, $this->keys->id) |
|
| 128 | + $this->redis->get($this->keys->visits . '_total') : $this->redis->zscore($this->keys->visits, $this->keys->id) |
|
| 130 | 129 | ); |
| 131 | 130 | } |
| 132 | 131 | |
@@ -18,20 +18,20 @@ discard block |
||
| 18 | 18 | __DIR__ . '/config/visits.php' => config_path('visits.php'), |
| 19 | 19 | ], 'config'); |
| 20 | 20 | |
| 21 | - Carbon::macro('endOfxHours', function ($xhours) { |
|
| 21 | + Carbon::macro('endOfxHours', function($xhours) { |
|
| 22 | 22 | |
| 23 | - if($xhours > 12) { |
|
| 23 | + if ($xhours > 12) { |
|
| 24 | 24 | throw new \Exception('12 is the maximum period in xHours feature'); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | $hour = collect(range(1, 24 / $xhours)) |
| 28 | - ->map(function ($hour) use ($xhours) { |
|
| 28 | + ->map(function($hour) use ($xhours) { |
|
| 29 | 29 | return $hour * $xhours; |
| 30 | - })->first(function ($hour) { |
|
| 30 | + })->first(function($hour) { |
|
| 31 | 31 | return $hour >= $this->hour; |
| 32 | 32 | }); |
| 33 | 33 | |
| 34 | - return $this->setTime($hour , 59, 59); |
|
| 34 | + return $this->setTime($hour, 59, 59); |
|
| 35 | 35 | }); |
| 36 | 36 | } |
| 37 | 37 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | public function register() |
| 44 | 44 | { |
| 45 | 45 | $this->mergeConfigFrom( |
| 46 | - __DIR__.'/config/visits.php', 'visits' |
|
| 46 | + __DIR__ . '/config/visits.php', 'visits' |
|
| 47 | 47 | ); |
| 48 | 48 | } |
| 49 | 49 | } |