Last active
November 22, 2016 03:16
-
-
Save cuonghuynh/2ffb3c7130a1cafc205ecd0d607c5ce5 to your computer and use it in GitHub Desktop.
Time ago in words
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
protected $appends = [ | |
'created_at_ago', | |
'updated_at_ago' | |
]; | |
public function getCreatedAtAgoAttribute() { | |
return $this->created_at->diffForHumans(); | |
} | |
public function getUpdatedAtAgoAttribute() { | |
return $this->updated_at->diffForHumans(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment