public function editCustomRecord($parameters) { $parameters['editors'] = config('cms.editors'); $parameters['customFieldGroups'] = CustomFieldGroup::builder()->where('resource_id_025', 'cms-article-family')->get(); $parameters['data'] = json_decode($parameters['object']->data_351); return $parameters; }
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 function editCustomRecord($parameters) { $parameters['categories'] = Category::where('lang_id_110', $parameters['lang']->id_001)->get(); $parameters['productTypes'] = array_map(function ($object) { $object->name = trans($object->name); return $object; }, config('market.productTypes')); $parameters['priceTypes'] = array_map(function ($object) { $object->name = trans($object->name); return $object; }, config('market.priceTypes')); $parameters['productClassTaxes'] = ProductClassTax::builder()->get(); $parameters['parentsProducts'] = Product::builder()->where('lang_id_112', base_lang()->id_001)->where('id_111', '<>', $parameters['id'])->whereNull('parent_product_id_111')->get(); $taxRules = TaxRule::builder()->where('country_id_103', config('market.taxCountry'))->where('customer_class_tax_id_106', config('market.taxCustomerClass'))->where('product_class_tax_id_107', $parameters['object']->product_class_tax_id_111)->orderBy('priority_104', 'asc')->get(); $taxes = TaxRuleLibrary::taxCalculateOverSubtotal($parameters['object']->subtotal_111, $taxRules); // ATTENTION! we create custom properties tax_amount_111 and total_111 $parameters['object']->tax_amount_111 = $taxes->sum('taxAmount'); $parameters['object']->total_111 = $parameters['object']->subtotal_111 + $parameters['object']->tax_amount_111; $attachments = AttachmentLibrary::getRecords($this->package, 'market-product', $parameters['object']->id_111, $parameters['lang']->id_001); $parameters['customFieldGroups'] = CustomFieldGroup::builder()->where('resource_id_025', 'market-product')->get(); $parameters['attachmentFamilies'] = AttachmentFamily::getAttachmentFamilies(['resource_id_015' => 'market-product']); $parameters = array_merge($parameters, $attachments); return $parameters; }
public function editCustomRecord($parameters) { // get attachments elements $attachments = AttachmentLibrary::getRecords('spas', 'spas-spa', $parameters['object']->id_180, $parameters['lang']->id_001); // merge parameters and attachments array $parameters['attachmentFamilies'] = AttachmentFamily::getAttachmentFamilies(['resource_id_015' => 'spas-spa']); $parameters['customFieldGroups'] = CustomFieldGroup::builder()->where('resource_id_025', 'spas-spa')->get(); $parameters['hotels'] = Hotel::builder()->where('active_170', true)->get(); $parameters = array_merge($parameters, $attachments); return $parameters; }