3.5 - Cancelling Failed Orders

This commit is contained in:
Adam Wathan
2016-11-14 21:46:01 -05:00
parent f341608264
commit 2e92881fb6
4 changed files with 38 additions and 0 deletions

View File

@@ -12,4 +12,13 @@ class Order extends Model
{
return $this->hasMany(Ticket::class);
}
public function cancel()
{
foreach ($this->tickets as $ticket) {
$ticket->update(['order_id' => null]);
}
$this->delete();
}
}