Skip to content

Commit

Permalink
Merge pull request #1 from svenluijten/namespace
Browse files Browse the repository at this point in the history
Use right namespace in trait & documentation
  • Loading branch information
jpmurray authored Jul 31, 2017
2 parents c34e2de + ed95b4a commit 50ada3d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ Unless you are using Laravel 5.5 (in which case, package auto-discovery will do

``` php

use jpmurray\LaravelCountdown\Countdown;

// To get time from 5 years ago until now, you can do the following.
// Note that you can send a string to the from and to methods, we will
// try to parse it with Carbon behind the scene
Expand Down
5 changes: 3 additions & 2 deletions src/Traits/CalculateTimeDiff.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use jpmurray\LaravelCountdown\Countdown;

trait CalculateTimeDiff
{
public function elapsed($attribute)
{
return \Countdown::from($this->{$attribute})->to(Carbon::now())->get();
return Countdown::from($this->{$attribute})->to(Carbon::now())->get();
}

public function until($attribute)
{
return \Countdown::from(Carbon::now())->to($this->{$attribute})->get();
return Countdown::from(Carbon::now())->to($this->{$attribute})->get();
}
}

0 comments on commit 50ada3d

Please sign in to comment.