protected function getPerformanceData($show, $rates) { $performances = $show->performances(); $pData = $performances->get()->jsonSerialize(); foreach ($pData as &$perf) { $bands = Performance::findOrFail($perf['id'])->seatMap()->first()->bands()->get(); foreach ($rates as $rate) { foreach ($bands as $band) { $sbr = ShowBandRate::where('band_id', $band->id)->where('rate_id', $rate->id)->first(); $perf['prices'][$rate->id][$band->id] = $sbr->price; } } } return $pData; }
public function getPrice() { $rate = $this->rate()->first(); $band = $this->seat()->first()->band()->first(); return ShowBandRate::where('band_id', $band->id)->where('rate_id', $rate->id)->first()->price; }