Skip to content

Commit

Permalink
fix missing string methods
Browse files Browse the repository at this point in the history
  • Loading branch information
abdumu committed Sep 10, 2019
1 parent 5a7227e commit a312fcd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Keys.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function visitsTotal()
public function ip($ip)
{
return $this->visits . '_' .
snake_case("recorded_ips:" . ($this->instanceOfModel ? "{$this->id}:" : '') . $ip);
Str::snake("recorded_ips:" . ($this->instanceOfModel ? "{$this->id}:" : '') . $ip);
}


Expand Down
3 changes: 2 additions & 1 deletion src/Traits/Periods.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace awssat\Visits\Traits;

use Illuminate\Support\Carbon;
use Illuminate\Support\Str;
use Exception;

trait Periods
Expand Down Expand Up @@ -42,7 +43,7 @@ protected function noExpiration($periodKey)
protected function newExpiration($period)
{
try {
$periodCarbon = $this->xHoursPeriod($period) ?? Carbon::now()->{'endOf' . studly_case($period)}();
$periodCarbon = $this->xHoursPeriod($period) ?? Carbon::now()->{'endOf' . Str::studly($period)}();
} catch (Exception $e) {
throw new Exception("Wrong period: `{$period}`! please update config/visits.php file.");
}
Expand Down
3 changes: 2 additions & 1 deletion src/Visits.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Illuminate\Support\Carbon;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Redis;
use Jaybizzle\CrawlerDetect\CrawlerDetect;

Expand Down Expand Up @@ -192,7 +193,7 @@ public function increment($inc = 1, $force = false, $ignore = [])
//NOTE: $$method is parameter also .. ($periods,$country,$refer)
foreach (['country', 'refer', 'periods', 'operatingSystem', 'language'] as $method) {
if(! in_array($method, $ignore)) {
$this->{'record'.studly_case($method)}($inc);
$this->{'record'.Str::studly($method)}($inc);
}
}
}
Expand Down

0 comments on commit a312fcd

Please sign in to comment.