128 - Making the Progress Bar Work

This commit is contained in:
Adam Wathan
2017-07-19 15:01:57 -04:00
parent 8f0d85e3d2
commit d0d4b5907a
3 changed files with 32 additions and 2 deletions

View File

@@ -104,4 +104,14 @@ class Concert extends Model
{
return $this->tickets()->sold()->count();
}
public function totalTickets()
{
return $this->tickets()->count();
}
public function percentSoldOut()
{
return number_format(($this->ticketsSold() / $this->totalTickets()) * 100, 2);
}
}