Ejemplo n.º 1
0
 /**
  * Mutator function to return the pivot timestamp as time ago
  * @return string 
  * The time since the badge was earned
  */
 public function getTimeAgoAttribute($value)
 {
     if (!isset($this->pivot->created_at)) {
         return null;
     }
     $timeAgo = new TimeAgo();
     return $timeAgo->get($this->pivot->created_at);
 }
Ejemplo n.º 2
0
 /**
  * Mutator function to return the pivot timestamp as time ago
  * @return string The time since the badge was earned
  */
 public function getTimeAgoAttribute($value)
 {
     $timeAgo = new TimeAgo();
     return $timeAgo->get($this->timestamp);
 }