@php $isDiscount = $variant === 'discount'; $roomNames = $rooms->mapWithKeys(fn($room) => [$room->code => '№ '.$room->code.' — '.$room->title])->all(); $roomIds = $rooms->mapWithKeys(fn($room) => [$room->code => $room->id])->all(); $roomPhotos = $rooms->mapWithKeys(function ($room) { $folder = str_replace('А', 'A', $room->code); return [ $room->code => collect(range(1,4))->map(fn($i) => asset('images/room/'.$folder.'/'.$i.'.jpg'))->all(), ]; })->all(); $selectedCode = array_search((int) old('room_id', 0), $roomIds, true); $selectedCode = $selectedCode === false ? '' : $selectedCode; @endphp