mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-02-04 19:48:42 +00:00
4.2 - Returning Order Details
This commit is contained in:
@@ -8,6 +8,11 @@ class Order extends Model
|
||||
{
|
||||
protected $guarded = [];
|
||||
|
||||
public function concert()
|
||||
{
|
||||
return $this->belongsTo(Concert::class);
|
||||
}
|
||||
|
||||
public function tickets()
|
||||
{
|
||||
return $this->hasMany(Ticket::class);
|
||||
@@ -26,4 +31,13 @@ class Order extends Model
|
||||
|
||||
$this->delete();
|
||||
}
|
||||
|
||||
public function toArray()
|
||||
{
|
||||
return [
|
||||
'email' => $this->email,
|
||||
'ticket_quantity' => $this->ticketQuantity(),
|
||||
'amount' => $this->ticketQuantity() * $this->concert->ticket_price,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user