Beispiel #1
0
 public function createCustomRecord($parameters)
 {
     $parameters['services'] = Service::where('lang_id_153', $parameters['lang']->id_001)->get();
     $parameters['environments'] = Environment::where('lang_id_150', $parameters['lang']->id_001)->get();
     $parameters['decorations'] = Decoration::where('lang_id_151', $parameters['lang']->id_001)->get();
     $parameters['relationships'] = Relationship::where('lang_id_152', $parameters['lang']->id_001)->get();
     $parameters['publications'] = Publication::all();
     $parameters['restaurantTypes'] = array_map(function ($object) {
         $object->name = trans($object->name);
         return $object;
     }, config('hotels.restaurantTypes'));
     $parameters['attachmentFamilies'] = AttachmentFamily::getAttachmentFamilies(['resource_id_015' => 'hotels-hotel']);
     $parameters['customFieldGroups'] = CustomFieldGroup::where('resource_id_025', 'hotels-hotel')->get();
     $parameters['attachmentsInput'] = json_encode([]);
     $parameters['hotelProductsIds'] = json_encode([]);
     $parameters['products'] = Product::builder()->where('active_111', true)->where('lang_id_112', $parameters['lang']->id_001)->get();
     // get attachments products with photo list
     $parameters['attachmentsProducts'] = Attachment::builder()->where('lang_id_016', $parameters['lang']->id_001)->where('resource_id_016', 'market-product')->where('family_id_016', config('hotels.idAttachmentsFamily.productList'))->get()->keyBy('object_id_016');
     if (isset($parameters['id'])) {
         // get attachments from base lang
         $attachments = AttachmentLibrary::getRecords($this->package, 'hotels-hotel', $parameters['id'], base_lang()->id_001, true);
         // merge parameters and attachments array
         $parameters = array_merge($parameters, $attachments);
         // get hotel products
         $parameters['hotelProducts'] = HotelProduct::getRecords(['hotel_id_177' => $parameters['id'], 'lang_id_177' => base_lang()->id_001])->keyBy('product_id_177');
         $parameters['hotelProductsIds'] = json_encode($parameters['hotelProducts']->keys()->map(function ($item, $key) {
             return strval($item);
         }));
     }
     return $parameters;
 }
Beispiel #2
0
 public function createCustomRecord($parameters)
 {
     $parameters['attachmentFamilies'] = AttachmentFamily::getAttachmentFamilies(['resource_id_015' => 'spas-spa']);
     $parameters['customFieldGroups'] = CustomFieldGroup::where('resource_id_025', 'spas-spa')->get();
     $parameters['attachmentsInput'] = json_encode([]);
     $parameters['hotels'] = Hotel::builder()->where('active_170', true)->get();
     if (isset($parameters['id'])) {
         // get attachments from base lang
         $attachments = AttachmentLibrary::getRecords($this->package, 'spas-spa', $parameters['id'], base_lang()->id_001, true);
         // merge parameters and attachments array
         $parameters = array_merge($parameters, $attachments);
     }
     return $parameters;
 }
 public function updateCustomRecord($parameters)
 {
     CustomFieldGroup::where('id_025', $parameters['id'])->update(['resource_id_025' => $this->request->input('resource'), 'name_025' => $this->request->input('name')]);
 }