コード例 #1
0
ファイル: CustomerController.php プロジェクト: syscover/crm
 public function storeCustomRecord($parameters)
 {
     $customer = Customer::create(['lang_id_301' => $this->request->has('lang') ? $this->request->input('lang') : null, 'group_id_301' => $this->request->input('group'), 'date_301' => $this->request->has('date') ? \DateTime::createFromFormat(config('pulsar.datePattern'), $this->request->input('date'))->getTimestamp() : null, 'company_301' => $this->request->has('company') ? $this->request->input('company') : null, 'tin_301' => $this->request->has('tin') ? $this->request->input('tin') : null, 'gender_id_301' => $this->request->has('gender') ? $this->request->input('gender') : null, 'treatment_id_301' => $this->request->has('treatment') ? $this->request->input('treatment') : null, 'state_id_301' => $this->request->has('state') ? $this->request->input('state') : null, 'name_301' => $this->request->has('name') ? $this->request->input('name') : null, 'surname_301' => $this->request->has('surname') ? $this->request->input('surname') : null, 'avatar_301' => $this->request->has('avatar') ? $this->request->input('avatar') : null, 'birth_date_301' => $this->request->has('birthDate') ? \DateTime::createFromFormat(config('pulsar.datePattern'), $this->request->input('birthDate'))->getTimestamp() : null, 'email_301' => $this->request->input('email'), 'phone_301' => $this->request->has('phone') ? $this->request->input('phone') : null, 'mobile_301' => $this->request->has('mobile') ? $this->request->input('mobile') : null, 'user_301' => $this->request->input('user'), 'password_301' => Hash::make($this->request->input('password')), 'active_301' => $this->request->has('active'), 'confirmed_301' => false, 'country_id_301' => $this->request->has('country') ? $this->request->input('country') : null, 'territorial_area_1_id_301' => $this->request->has('territorialArea1') ? $this->request->input('territorialArea1') : null, 'territorial_area_2_id_301' => $this->request->has('territorialArea2') ? $this->request->input('territorialArea2') : null, 'territorial_area_3_id_301' => $this->request->has('territorialArea3') ? $this->request->input('territorialArea3') : null, 'cp_301' => $this->request->has('cp') ? $this->request->input('cp') : null, 'locality_301' => $this->request->has('locality') ? $this->request->input('locality') : null, 'address_301' => $this->request->has('address') ? $this->request->input('address') : null, 'latitude_301' => $this->request->has('latitude') ? $this->request->input('latitude') : null, 'longitude_301' => $this->request->has('longitude') ? $this->request->input('longitude') : null]);
     // set attachments
     $attachments = json_decode($this->request->input('attachments'));
     AttachmentLibrary::storeAttachments($attachments, 'crm', 'crm-customer', $customer->id_301, base_lang()->id_001);
 }
コード例 #2
0
ファイル: SpaController.php プロジェクト: syscover/spas
 public function storeCustomRecord($parameters)
 {
     if (!$this->request->has('id')) {
         // create new spa
         $spa = Spa::create(['field_group_id_180' => $this->request->has('customFieldGroup') ? $this->request->input('customFieldGroup') : null, 'hotel_id_180' => $this->request->has('hotel') ? $this->request->input('hotel') : null, 'name_180' => $this->request->input('name'), 'slug_180' => $this->request->input('slug'), 'web_180' => $this->request->input('web'), 'web_url_180' => $this->request->input('webUrl'), 'contact_180' => $this->request->input('contact'), 'email_180' => $this->request->input('email'), 'phone_180' => $this->request->input('phone'), 'mobile_180' => $this->request->input('mobile'), 'fax_180' => $this->request->input('fax'), 'active_180' => $this->request->has('active'), 'country_id_180' => $this->request->input('country'), 'territorial_area_1_id_180' => $this->request->has('territorialArea1') ? $this->request->input('territorialArea1') : null, 'territorial_area_2_id_180' => $this->request->has('territorialArea2') ? $this->request->input('territorialArea2') : null, 'territorial_area_3_id_180' => $this->request->has('territorialArea3') ? $this->request->input('territorialArea3') : null, 'cp_180' => $this->request->input('cp'), 'locality_180' => $this->request->input('locality'), 'address_180' => $this->request->input('address'), 'latitude_180' => str_replace(',', '', $this->request->input('latitude')), 'longitude_180' => str_replace(',', '', $this->request->input('longitude'))]);
         $id = $spa->id_180;
         $idLang = null;
     } else {
         // create spa language
         $id = $this->request->input('id');
         $idLang = $id;
     }
     Spa::where('id_180', $id)->update(['data_lang_180' => Spa::addLangDataRecord($this->request->input('lang'), $idLang)]);
     SpaLang::create(['id_181' => $id, 'lang_id_181' => $this->request->input('lang'), 'description_title_181' => $this->request->has('descriptionTitle') ? $this->request->input('descriptionTitle') : null, 'description_181' => $this->request->has('description') ? $this->request->input('description') : null, 'treatments_181' => $this->request->has('treatments') ? $this->request->input('treatments') : null]);
     // set attachments
     $attachments = json_decode($this->request->input('attachments'));
     AttachmentLibrary::storeAttachments($attachments, $this->package, 'spas-spa', $id, $this->request->input('lang'));
     // set custom fields
     if (!empty($this->request->input('customFieldGroup'))) {
         CustomFieldResultLibrary::storeCustomFieldResults($this->request, $this->request->input('customFieldGroup'), 'spas-spa', $id, $this->request->input('lang'));
     }
 }
コード例 #3
0
ファイル: HotelController.php プロジェクト: syscover/hotels
 public function storeCustomRecord($parameters)
 {
     if (!$this->request->has('id')) {
         // create new hotel
         $hotel = Hotel::create(['field_group_id_170' => $this->request->has('customFieldGroup') ? $this->request->input('customFieldGroup') : null, 'name_170' => $this->request->input('name'), 'slug_170' => $this->request->input('slug'), 'web_170' => $this->request->input('web'), 'web_url_170' => $this->request->input('webUrl'), 'contact_170' => $this->request->input('contact'), 'email_170' => $this->request->input('email'), 'booking_email_170' => $this->request->input('bookingEmail'), 'phone_170' => $this->request->input('phone'), 'mobile_170' => $this->request->input('mobile'), 'fax_170' => $this->request->input('fax'), 'environment_170' => $this->request->has('environment') ? $this->request->input('environment') : null, 'decoration_170' => $this->request->has('decoration') ? $this->request->input('decoration') : null, 'relationship_170' => $this->request->has('relationship') ? $this->request->input('relationship') : null, 'n_rooms_170' => $this->request->input('nRooms'), 'n_places_170' => $this->request->input('nPlaces'), 'n_events_rooms_170' => $this->request->input('nEventsRooms'), 'n_events_rooms_places_170' => $this->request->input('nEventsRoomsPlaces'), 'user_170' => $this->request->input('user'), 'password_170' => Hash::make($this->request->input('password')), 'active_170' => $this->request->has('active'), 'country_id_170' => $this->request->input('country'), 'territorial_area_1_id_170' => $this->request->has('territorialArea1') ? $this->request->input('territorialArea1') : null, 'territorial_area_2_id_170' => $this->request->has('territorialArea2') ? $this->request->input('territorialArea2') : null, 'territorial_area_3_id_170' => $this->request->has('territorialArea3') ? $this->request->input('territorialArea3') : null, 'cp_170' => $this->request->has('cp') ? $this->request->input('cp') : null, 'locality_170' => $this->request->input('locality'), 'address_170' => $this->request->input('address'), 'latitude_170' => str_replace(',', '', $this->request->input('latitude')), 'longitude_170' => str_replace(',', '', $this->request->input('longitude')), 'booking_url_170' => $this->request->input('bookingUrl'), 'country_chef_restaurant_170' => $this->request->has('countryChefRestaurant'), 'country_chef_url_170' => $this->request->input('countryChefUrl'), 'restaurant_name_170' => $this->request->input('restaurantName'), 'restaurant_type_id_170' => $this->request->has('restaurantType') ? $this->request->input('restaurantType') : null, 'restaurant_terrace_170' => $this->request->has('restaurantTerrace'), 'billing_name_170' => $this->request->input('billingName'), 'billing_surname_170' => $this->request->input('billingSurname'), 'billing_company_name_170' => $this->request->input('billingCompanyName'), 'billing_tin_170' => $this->request->input('billingTin'), 'billing_country_id_170' => $this->request->has('billingCountry') ? $this->request->input('billingCountry') : null, 'billing_territorial_area_1_id_170' => $this->request->has('billingTerritorialArea1') ? $this->request->input('billingTerritorialArea1') : null, 'billing_territorial_area_2_id_170' => $this->request->has('billingTerritorialArea2') ? $this->request->input('billingTerritorialArea2') : null, 'billing_territorial_area_3_id_170' => $this->request->has('billingTerritorialArea3') ? $this->request->input('billingTerritorialArea3') : null, 'billing_cp_170' => $this->request->has('billingCp') ? $this->request->input('billingCp') : null, 'billing_locality_170' => $this->request->input('billingLocality'), 'billing_address_170' => $this->request->input('billingAddress'), 'billing_phone_170' => $this->request->input('billingPhone'), 'billing_email_170' => $this->request->input('billingEmail'), 'billing_iban_country_170' => $this->request->input('billingIbanCountry'), 'billing_iban_check_digits_170' => $this->request->input('billingIbanCheckDigits'), 'billing_iban_basic_bank_account_number_170' => $this->request->input('billingIbanBasicBankAccountNumber'), 'billing_bic_170' => $this->request->input('billingBic')]);
         $id = $hotel->id_170;
         $idLang = null;
         // publications
         if (is_array($this->request->input('published'))) {
             $hotel->getPublications()->sync($this->request->input('published'));
         }
         // services
         if (is_array($this->request->input('services'))) {
             $hotel->getServices()->sync($this->request->input('services'));
         }
     } else {
         // create hotel language
         $id = $this->request->input('id');
         $idLang = $id;
     }
     Hotel::where('id_170', $id)->update(['data_lang_170' => Hotel::addLangDataRecord($this->request->input('lang'), $idLang)]);
     HotelLang::create(['id_171' => $id, 'lang_id_171' => $this->request->input('lang'), 'cuisine_171' => $this->request->has('cuisine') ? $this->request->input('cuisine') : null, 'special_dish_171' => $this->request->has('specialDish') ? $this->request->input('specialDish') : null, 'indications_171' => $this->request->has('indications') ? $this->request->input('indications') : null, 'interest_points_171' => $this->request->has('interestPoints') ? $this->request->input('interestPoints') : null, 'environment_description_171' => $this->request->has('environmentDescription') ? $this->request->input('environmentDescription') : null, 'construction_171' => $this->request->has('construction') ? $this->request->input('construction') : null, 'activities_171' => $this->request->has('activities') ? $this->request->input('activities') : null, 'description_title_171' => $this->request->has('descriptionTitle') ? $this->request->input('descriptionTitle') : null, 'description_171' => $this->request->has('description') ? $this->request->input('description') : null]);
     // set hotel products
     $hotelProducts = [];
     $products = json_decode($this->request->input('products'));
     foreach ($products as $product) {
         $hotelProducts[] = ['hotel_id_177' => $id, 'product_id_177' => $product, 'lang_id_177' => $this->request->input('lang'), 'description_177' => $this->request->input('d' . $product)];
     }
     if (count($hotelProducts) > 0) {
         HotelProduct::insert($hotelProducts);
     }
     // set attachments
     $attachments = json_decode($this->request->input('attachments'));
     AttachmentLibrary::storeAttachments($attachments, $this->package, 'hotels-hotel', $id, $this->request->input('lang'));
     // set custom fields
     if (!empty($this->request->input('customFieldGroup'))) {
         CustomFieldResultLibrary::storeCustomFieldResults($this->request, $this->request->input('customFieldGroup'), 'hotels-hotel', $id, $this->request->input('lang'));
     }
 }
コード例 #4
0
ファイル: ProductController.php プロジェクト: syscover/market
 public function storeCustomRecord($parameters)
 {
     if (!$this->request->has('id')) {
         // create new product
         $product = Product::create(['field_group_id_111' => $this->request->has('customFieldGroup') ? $this->request->input('customFieldGroup') : null, 'type_id_111' => $this->request->input('productType'), 'parent_product_id_111' => $this->request->has('parentProduct') ? $this->request->input('parentProduct') : null, 'weight_111' => $this->request->has('weight') ? $this->request->input('weight') : 0, 'active_111' => $this->request->has('active'), 'sorting_111' => $this->request->has('sorting') ? $this->request->input('sorting') : null, 'price_type_id_111' => $this->request->input('priceType'), 'subtotal_111' => $this->getSubtotalOverTotal(), 'product_class_tax_id_111' => $this->request->has('productClassTax') ? $this->request->input('productClassTax') : null]);
         $id = $product->id_111;
         $idLang = null;
     } else {
         // create product with other language
         $id = $this->request->input('id');
         $idLang = $id;
     }
     // update product with data lang
     Product::where('id_111', $id)->update(['data_lang_111' => Product::addLangDataRecord($this->request->input('lang'), $idLang)]);
     ProductLang::create(['id_112' => $id, 'lang_id_112' => $this->request->input('lang'), 'name_112' => $this->request->input('name'), 'slug_112' => $this->request->input('slug'), 'description_112' => $this->request->input('description')]);
     $product = Product::where('id_111', $id)->first();
     // set categories
     if (is_array($this->request->input('categories'))) {
         $product->getCategories()->sync($this->request->input('categories'));
     }
     // set attachments
     $attachments = json_decode($this->request->input('attachments'));
     AttachmentLibrary::storeAttachments($attachments, $this->package, 'market-product', $id, $this->request->input('lang'));
     // set custom fields
     if (!empty($this->request->input('customFieldGroup'))) {
         CustomFieldResultLibrary::storeCustomFieldResults($this->request, $this->request->input('customFieldGroup'), 'market-product', $id, $this->request->input('lang'));
     }
 }
コード例 #5
0
ファイル: ArticleController.php プロジェクト: syscover/cms
 public function storeCustomRecord($parameters)
 {
     // check if there is id
     if ($this->request->has('id')) {
         $id = $this->request->input('id');
         $idLang = $id;
     } else {
         $id = Article::max('id_355');
         $id++;
         $idLang = null;
     }
     $article = Article::create(['id_355' => $id, 'lang_id_355' => $this->request->input('lang'), 'author_id_355' => $this->request->input('author'), 'section_id_355' => $this->request->input('section'), 'family_id_355' => $this->request->has('family') ? $this->request->input('family') : null, 'status_id_355' => $this->request->input('status'), 'publish_355' => $this->request->has('publish') ? \DateTime::createFromFormat(config('pulsar.datePattern') . ' H:i', $this->request->input('publish'))->getTimestamp() : (int) date('U'), 'publish_text_355' => $this->request->has('publish') ? $this->request->input('publish') : date(config('pulsar.datePattern') . ' H:i'), 'date_355' => $this->request->has('date') ? \DateTime::createFromFormat(config('pulsar.datePattern'), $this->request->input('date'))->getTimestamp() : null, 'title_355' => $this->request->has('title') ? $this->request->input('title') : null, 'slug_355' => $this->request->has('slug') ? $this->request->input('slug') : null, 'link_355' => $this->request->has('link') ? $this->request->input('link') : null, 'blank_355' => $this->request->has('blank'), 'sorting_355' => $this->request->has('sorting') ? $this->request->input('sorting') : null, 'article_355' => $this->request->input('article'), 'data_lang_355' => Article::addLangDataRecord($this->request->input('lang'), $idLang), 'data_355' => null]);
     // get object with builder, to get every relations
     $article = Article::builder()->where('id_355', $article->id_355)->where('lang_id_355', $article->lang_id_355)->first();
     // tags
     $tags = json_decode($this->request->input('jsonTags'));
     if (is_array($tags) && count($tags) > 0) {
         $idTags = [];
         foreach ($tags as $tag) {
             if ($tag->value === 'null') {
                 $tagObj = Tag::create(['lang_id_358' => $this->request->input('lang'), 'name_358' => $tag->label]);
                 $idTags[] = $tagObj->id_358;
             } else {
                 $idTags[] = $tag->value;
             }
         }
         $article->getTags()->sync($idTags);
     }
     // set categories
     if (is_array($this->request->input('categories'))) {
         $article->getCategories()->sync($this->request->input('categories'));
     }
     // set attachments
     $attachments = json_decode($this->request->input('attachments'));
     AttachmentLibrary::storeAttachments($attachments, 'cms', 'cms-article', $id, $this->request->input('lang'));
     // set custom fields
     if ($article->field_group_id_351 !== null) {
         CustomFieldResultLibrary::storeCustomFieldResults($this->request, $article->field_group_id_351, 'cms-article-family', $article->id_355, $this->request->input('lang'));
     }
 }