Ejemplo n.º 1
0
 public function getDaysLeftAttribute()
 {
     $daysleft = 0;
     if ($this->goal()->orderBy('start')->first()) {
         $firstGoal = $this->goal()->orderBy('start')->first()->start;
         $start = new \Carbon\Carbon($firstGoal);
         $now = \Carbon\Carbon::now();
         if ($start->diff($now)->days >= 1) {
             $daysleft = $start->diff($now)->days;
         }
     }
     return $daysleft;
 }