whereNull('order_id')->whereNull('reserved_at'); } public function reserve() { $this->update(['reserved_at' => Carbon::now()]); } public function release() { $this->update(['reserved_at' => null]); } public function claimFor($order) { $this->code = TicketCode::generateFor($this); $order->tickets()->save($this); } public function concert() { return $this->belongsTo(Concert::class); } public function getPriceAttribute() { return $this->concert->ticket_price; } }