mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-02-01 13:47:23 +00:00
5.3 - Preparing for Extraction
This commit is contained in:
@@ -32,7 +32,7 @@ class Concert extends Model
|
||||
|
||||
public function orders()
|
||||
{
|
||||
return $this->hasMany(Order::class);
|
||||
return $this->belongsToMany(Order::class, 'tickets');
|
||||
}
|
||||
|
||||
public function hasOrderFor($customerEmail)
|
||||
@@ -69,9 +69,9 @@ class Concert extends Model
|
||||
|
||||
public function createOrder($email, $tickets)
|
||||
{
|
||||
$order = $this->orders()->create([
|
||||
$order = Order::create([
|
||||
'email' => $email,
|
||||
'amount' => $tickets->count() * $this->ticket_price,
|
||||
'amount' => $tickets->sum('price'),
|
||||
]);
|
||||
|
||||
foreach ($tickets as $ticket) {
|
||||
|
||||
Reference in New Issue
Block a user