mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-01-29 18:45:58 +00:00
30 lines
460 B
PHP
30 lines
460 B
PHP
<?php
|
|
|
|
namespace App;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Order extends Model
|
|
{
|
|
protected $guarded = [];
|
|
|
|
public function tickets()
|
|
{
|
|
return $this->hasMany(Ticket::class);
|
|
}
|
|
|
|
public function ticketQuantity()
|
|
{
|
|
return $this->tickets()->count();
|
|
}
|
|
|
|
public function cancel()
|
|
{
|
|
foreach ($this->tickets as $ticket) {
|
|
$ticket->release();
|
|
}
|
|
|
|
$this->delete();
|
|
}
|
|
}
|