127 - Calculating Tickets Sold

This commit is contained in:
Adam Wathan
2017-07-19 15:01:45 -04:00
parent 5f3c07b10d
commit 8f0d85e3d2
4 changed files with 26 additions and 5 deletions

View File

@@ -15,6 +15,11 @@ class Ticket extends Model
return $query->whereNull('order_id')->whereNull('reserved_at');
}
public function scopeSold($query)
{
return $query->whereNotNull('order_id');
}
public function reserve()
{
$this->update(['reserved_at' => Carbon::now()]);