mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-01-30 07:46:23 +00:00
25 lines
387 B
PHP
25 lines
387 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 cancel()
|
|
{
|
|
foreach ($this->tickets as $ticket) {
|
|
$ticket->update(['order_id' => null]);
|
|
}
|
|
|
|
$this->delete();
|
|
}
|
|
}
|