Skip to content

Instantly share code, notes, and snippets.

@cuonghuynh
Last active November 22, 2016 03:16
Show Gist options
  • Save cuonghuynh/2ffb3c7130a1cafc205ecd0d607c5ce5 to your computer and use it in GitHub Desktop.
Save cuonghuynh/2ffb3c7130a1cafc205ecd0d607c5ce5 to your computer and use it in GitHub Desktop.
Time ago in words
<?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