public function ListareDetaliiHotel($tara, $oras, $slughotel)
 {
     $hotel = Hoteluri::findBySlug($slughotel);
     $oras = Orase::findbyslug($oras);
     $hotel_id = Hoteluri::findOrFail($hotel->id);
     $weather = Weather::where('HotelID', $hotel->id)->get();
     $hoteluriSimilare = Hoteluri::where('AidaID', '<>', $hotel->AidaID)->where('City', $oras->AidaID)->take(3)->get();
     return view('frontend.detalii-hotel')->with('hotel', $hotel)->with('weather', $weather)->with('hoteluriSimilare', $hoteluriSimilare)->with('hotel_id', $hotel_id);
 }
Пример #2
0
 public function GetAllHotels($operator)
 {
     //        $xml = new SimpleXMLElement('hoteluri.xml', null, TRUE);
     //        dd(json_decode(json_encode($xml->AccUnit),TRUE));
     $AidaHoteluri = Soap::AidaSoap($operator, 'AccUnits', ['AIDA_AccUnitsRQ' => ['Filters' => []]])->AccUnits->AccUnit;
     foreach ($AidaHoteluri as $hotel) {
         $array = ['AidaID' => $hotel->ID, 'Type' => $hotel->Type->_, 'Name' => $hotel->Name, 'Themes' => $hotel->ThemesIDS, 'Stars' => $hotel->Stars, 'Category' => @$hotel->Category->_, 'Country' => $hotel->Destination->Country->ID, 'City' => $hotel->Destination->City->ID, 'Region' => @$hotel->Destination->Region->ID, 'Address' => @$hotel->Destination->Address, 'Telephone' => @$hotel->Contact->Telephone, 'Email' => '*****@*****.**', 'FacilitiesDescription' => @$hotel->Descriptions->FacilitiesDescription, 'ShortDescription' => @$hotel->Descriptions->ShortDescription, 'FullDescription' => @$hotel->Descriptions->FullDescription, 'RoomsDescription' => @$hotel->Descriptions->RoomsDescription, 'DrivingDirections' => @$hotel->Descriptions->DrivingDirections, 'TouristicAttractions' => @$hotel->Descriptions->TouristicAttractions, 'Latitude' => @$hotel->Latitude, 'Longitude' => @$hotel->Longitude, 'Operator' => $operator];
         $imagini = @$hotel->Gallery->GalleryImage;
         $hoteluri = Hoteluri::where('AidaID', $hotel->ID)->first();
         //-------------verific daca exista hotel---------------------//
         if (isset($hoteluri)) {
             //---------verific daca este setat ca updatabil------------//
             if ($hoteluri->Updatabil == 1) {
                 //--------------fac update de continut---------------//
                 $hoteluri->update($array);
                 //-------------sterg pozele aferente----------------//
                 PozeHoteluri::where('AidaID', $hotel->ID)->delete();
                 File::delete("Hoteluri/{$operator}/{$hotel->ID}");
                 //-----------preiau pozele noi daca exista--------------------//
                 if (isset($imagini)) {
                     foreach ($imagini as $imagine) {
                         if (@$imagine->URL != null) {
                             $numefisier = parseurl($imagine->URL, 'url');
                             Image::make(file_get_contents($imagine->URL))->save("Hoteluri/{$operator}/{$hotel->ID}/{$numefisier}");
                             $mainpicture = @$imagine->MainPicture != null ? 1 : 0;
                             $array_poze = ['AidaID' => $hotel->ID, 'PictureName' => $numefisier, 'MainPicture' => $mainpicture];
                             PozeHoteluri::create($array_poze);
                         }
                     }
                 }
                 //---------setez updatabil 0----------
                 Hoteluri::findOrFail($hoteluri->id)->update(['Updatabil' => 0]);
             }
             //---------------------daca nu exista preiau datele si pozele-------------------
         } else {
             $hid = Hoteluri::create($array);
             File::makeDirectory("Hoteluri/{$operator}/{$hotel->ID}", 0777);
             if (isset($imagini)) {
                 foreach ($imagini as $imagine) {
                     if (@$imagine->URL != null) {
                         $numefisier = parseurl($imagine->URL, 'url');
                         Image::make(file_get_contents($imagine->URL))->save("Hoteluri/{$operator}/{$hotel->ID}/{$numefisier}");
                         $mainpicture = @$imagine->MainPicture != null ? 1 : 0;
                         $array_poze = ['AidaID' => $hotel->ID, 'PictureName' => $numefisier, 'MainPicture' => $mainpicture];
                         PozeHoteluri::create($array_poze);
                     }
                 }
             }
             //---------setez updatabil 0----------
             Hoteluri::findOrFail($hid->id)->update(['Updatabil' => 0]);
         }
     }
 }