Example #1
0
 public static function deleteAttachment($args)
 {
     $query = Attachment::builder();
     if (isset($args['lang_id_016'])) {
         $query->where('lang_id_016', $args['lang_id_016']);
     }
     if (isset($args['resource_id_016'])) {
         $query->where('resource_id_016', $args['resource_id_016']);
     }
     if (isset($args['object_id_016'])) {
         $query->where('object_id_016', $args['object_id_016']);
     }
     return $query->delete();
 }
Example #2
0
 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;
 }
Example #3
0
 private function sendEmails(Booking $booking)
 {
     // objects from place
     if (isset($booking->place_id_225)) {
         $result = collect(config('booking.models'))->where('id', $booking->place_id_225);
         if (count($result) === 0) {
             return response()->json(['status' => 'error', 'code' => 404, 'message' => 'Records not found']);
         }
         // model constructor
         $model = App::make($result->first()->model);
         // use sofa to get lang from lang table of object query
         $establishment = $model->builder()->where('lang_id', base_lang()->id_001)->where('id', $booking->object_id_225)->first();
         $attachment = Attachment::builder()->where('lang_id_016', base_lang()->id_001)->where('resource_id_016', 'hotels-hotel')->where('object_id_016', $establishment->id)->where('family_id_016', 1)->orderBy('sorting', 'asc')->first();
         //****************************
         // get values to Master Card
         //****************************
         $customFields = CustomField::where('group_id_026', 4)->get();
         if (isset($customFields) && $customFields->where('name_026', 'master_card_feature')->count() > 0) {
             $masterCardFeatures = $customFields->where('name_026', 'master_card_feature')->first()->getResults()->where('object_id_028', $establishment->id_170)->where('lang_id_028', 'es')->get()->first();
         } else {
             $masterCardFeatures = null;
         }
         // get vouchers
         $vouchers = Voucher::builder()->whereIn('id_226', json_decode($booking->data_225))->get();
         // status confirmed
         if ($booking->status_225 == 1) {
             Mail::to('*****@*****.**')->bcc('*****@*****.**')->cc('*****@*****.**')->send(new BookingEmail('booking::emails.customer_booking_notification', trans('booking::pulsar.subject_customer_booking_email', ['bookingId' => $booking->id_225 . '/' . date('Y')]), $booking, $establishment, $vouchers, $attachment, $masterCardFeatures));
             Mail::to('*****@*****.**')->bcc('*****@*****.**')->cc('*****@*****.**')->send(new BookingEmail('booking::emails.hotel_booking_notification', trans('booking::pulsar.subject_hotel_booking_email', ['bookingId' => $booking->id_225 . '/' . date('Y')]), $booking, $establishment, $vouchers, $attachment, $masterCardFeatures));
         } elseif ($booking->status_225 == 3) {
             Mail::to('*****@*****.**')->bcc('*****@*****.**')->cc('*****@*****.**')->send(new BookingEmail('booking::emails.customer_cancel_booking_notification', trans('booking::pulsar.subject_customer_cancel_booking_email', ['bookingId' => $booking->id_225 . '/' . date('Y')]), $booking, $establishment, $vouchers, $attachment, $masterCardFeatures));
             Mail::to('*****@*****.**')->bcc('*****@*****.**')->cc('*****@*****.**')->send(new BookingEmail('booking::emails.hotel_cancel_booking_notification', trans('booking::pulsar.subject_hotel_cancel_booking_email', ['bookingId' => $booking->id_225 . '/' . date('Y')]), $booking, $establishment, $vouchers, $attachment, $masterCardFeatures));
         }
     }
 }