public function updateCustomRecord($parameters) { Decoration::where('id_151', $parameters['id'])->where('lang_id_151', $this->request->input('lang'))->update(['name_151' => $this->request->input('name')]); }
public function editCustomRecord($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')); // get attachments elements $attachments = AttachmentLibrary::getRecords($this->package, 'hotels-hotel', $parameters['object']->id_170, $parameters['lang']->id_001); $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'); // merge parameters and attachments array $parameters['customFieldGroups'] = CustomFieldGroup::builder()->where('resource_id_025', 'hotels-hotel')->get(); $parameters['attachmentFamilies'] = AttachmentFamily::getAttachmentFamilies(['resource_id_015' => 'hotels-hotel']); $parameters = array_merge($parameters, $attachments); // get hotel products $parameters['hotelProducts'] = $parameters['object']->getHotelProducts->keyBy('product_id_177'); $parameters['hotelProductsIds'] = json_encode($parameters['hotelProducts']->keys()->map(function ($item, $key) { return strval($item); })); return $parameters; }
public static function customCount($request, $parameters) { return Decoration::where('lang_id_151', $parameters['lang'])->getQuery(); }