mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-02-04 15:48:29 +00:00
50 - Refactor "Long Parameter List" Using "Preserve Whole Object"
This commit is contained in:
@@ -22,6 +22,18 @@ class Order extends Model
|
||||
return $order;
|
||||
}
|
||||
|
||||
public static function fromReservation($reservation)
|
||||
{
|
||||
$order = self::create([
|
||||
'email' => $reservation->email(),
|
||||
'amount' => $reservation->totalCost(),
|
||||
]);
|
||||
|
||||
$order->tickets()->saveMany($reservation->tickets());
|
||||
|
||||
return $order;
|
||||
}
|
||||
|
||||
public function concert()
|
||||
{
|
||||
return $this->belongsTo(Concert::class);
|
||||
|
||||
Reference in New Issue
Block a user