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['langs'] = Lang::all(); $parameters['groups'] = Group::all(); $parameters['genres'] = array_map(function ($object) { $object->name = trans($object->name); return $object; }, config('pulsar.genres')); $parameters['treatments'] = array_map(function ($object) { $object->name = trans($object->name); return $object; }, config('pulsar.treatments')); $parameters['states'] = array_map(function ($object) { $object->name = trans($object->name); return $object; }, config('pulsar.states')); // get attachments elements $attachments = AttachmentLibrary::getRecords('crm', 'crm-customer', $parameters['object']->id_301, base_lang()->id_001); // merge parameters and attachments array $parameters['attachmentFamilies'] = AttachmentFamily::getAttachmentFamilies(['resource_id_015' => 'cms-article']); $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; }
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) { $parameters['sections'] = Section::all(); $parameters['families'] = ArticleFamily::all(); $parameters['tags'] = []; $tags = Tag::builder()->where('lang_id_358', $parameters['object']->lang_id_355)->get(); foreach ($tags as $tag) { $parameters['tags'][] = ['value' => $tag->id_358, 'label' => $tag->name_358]; } $objectTags = $parameters['object']->getTags; $parameters['selectTags'] = []; foreach ($objectTags as $objectTag) { $parameters['selectTags'][] = ['value' => $objectTag->id_358, 'label' => $objectTag->name_358]; } $parameters['categories'] = Category::builder()->where('lang_id_352', $parameters['object']->lang_id)->get(); $parameters['statuses'] = [(object) ['id' => 0, 'name' => trans('cms::pulsar.draft')], (object) ['id' => 1, 'name' => trans('cms::pulsar.publish')]]; // get attachments elements $attachments = AttachmentLibrary::getRecords('cms', 'cms-article', $parameters['object']->id_355, $parameters['object']->lang_id); // merge parameters and attachments array $parameters['attachmentFamilies'] = AttachmentFamily::getAttachmentFamilies(['resource_id_015' => 'cms-article']); $parameters = array_merge($parameters, $attachments); return $parameters; }