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 static function getRecords($parameters) { $query = Hotel::builder(); if (isset($parameters['slug_170'])) { $query->where('slug_170', $parameters['slug_170']); } if (isset($parameters['lang_id_171'])) { $query->where('lang_id_171', $parameters['lang_id_171']); } if (isset($parameters['territorial_area_1_id_170'])) { $query->where('territorial_area_1_id_170', $parameters['territorial_area_1_id_170']); } if (isset($parameters['publication_id_175'])) { $query->whereIn('id_170', function ($query) use($parameters) { $query->select('hotel_id_175')->from('007_175_hotels_publications')->whereIn('publication_id_175', $parameters['publication_id_175']); }); } if (isset($parameters['active_170'])) { $query->where('active_170', true); } return $query->get(); }