Skip to content
This repository has been archived by the owner on Nov 28, 2019. It is now read-only.

Commit

Permalink
Fix: bug with timezones producing a fatal error
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexMordred committed Feb 10, 2018
1 parent 6ce2d56 commit 7b7964d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
9 changes: 0 additions & 9 deletions src/Models/Visit.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,4 @@ class Visit extends Model
'is_bot' => 'boolean',
'is_mobile' => 'boolean',
];

protected $appends = ['created_at_timezoned'];

public function getCreatedAtTimezonedAttribute()
{
return Carbon::parse($this->created_at)
->tz(config('visitortracker.timezone', 'UTC'))
->format(config('visitortracker.datetime_format'))
}
}
4 changes: 3 additions & 1 deletion src/views/_last_visit.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
@if (!isset($hideLastVisitDatetime))
{{ $visit->created_at_timezoned }}<br>
{{ \Carbon\Carbon::parse($visit->created_at)
->tz(config('visitortracker.timezone', 'UTC'))
->format(config('visitortracker.datetime_format')) }}<br>
@endif

@include('visitstats::_visitor')
4 changes: 3 additions & 1 deletion src/views/_table_requests.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
@foreach ($visits as $visit)
<tr>
<td>
{{ $visit->created_at_timezoned }}
{{ \Carbon\Carbon::parse($visit->created_at)
->tz(config('visitortracker.timezone', 'UTC'))
->format(config('visitortracker.datetime_format')) }}

<br>

Expand Down

0 comments on commit 7b7964d

Please sign in to comment.