public function updateCustomRecord($parameters)
 {
     // get object to update data and data_lang field
     $customField = CustomField::find($this->request->input('id'));
     // get values
     $data = json_decode($customField->data_026, true);
     // set values
     $data['labels'][$this->request->input('lang')] = $this->request->input('label');
     CustomField::where('id_026', $parameters['id'])->update(['group_id_026' => $this->request->input('group'), 'name_026' => $this->request->input('name'), 'field_type_id_026' => $this->request->input('fieldType'), 'field_type_name_026' => collect(config('pulsar.fieldTypes'))->keyBy('id')[$this->request->input('fieldType')]->name, 'data_type_id_026' => $this->request->input('dataType'), 'data_type_name_026' => collect(config('pulsar.dataTypes'))->keyBy('id')[$this->request->input('dataType')]->name, 'required_026' => $this->request->has('required'), 'sorting_026' => empty($this->request->input('sorting')) ? null : $this->request->input('sorting'), 'max_length_026' => empty($this->request->input('maxLength')) ? null : $this->request->input('maxLength'), 'pattern_026' => empty($this->request->input('pattern')) ? null : $this->request->input('pattern'), 'label_size_026' => empty($this->request->input('labelSize')) ? null : $this->request->input('labelSize'), 'field_size_026' => empty($this->request->input('fieldSize')) ? null : $this->request->input('fieldSize'), 'data_026' => json_encode($data)]);
 }
Example #2
0
 public static function deleteTranslationRecord($parameters, $deleteLangDataRecord = true)
 {
     $customField = CustomField::find($parameters['id']);
     // get values
     $data = collect(json_decode($customField->data_026, true)['labels']);
     unset($data[$parameters['lang']]);
     CustomField::where('id_026', $parameters['id'])->update(['data_026' => json_encode(['labels' => $data])]);
     // set values on data_lang_026
     CustomField::deleteLangDataRecord($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));
         }
     }
 }