public function updateCustomRecord($parameters) { Tag::where('id_038', $parameters['id'])->update(['name_038' => $this->request->input('name')]); }
public function updateCustomRecord($parameters) { Article::where('id_355', $parameters['id'])->where('lang_id_355', $this->request->input('lang'))->update(['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' => \DateTime::createFromFormat(config('pulsar.datePattern'), $this->request->input('date'))->getTimestamp(), 'title_355' => $this->request->input('title'), '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_355' => null]); $article = Article::builder()->where('id_355', $parameters['id'])->where('lang_id_355', $parameters['lang'])->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->tags()->sync($idTags); } // categories if (is_array($this->request->input('categories'))) { $article->getCategories()->sync($this->request->input('categories')); } else { $article->getCategories()->detach(); } // set custom fields if ($article->field_group_id_351 !== null) { CustomFieldResultLibrary::deleteCustomFieldResults('cms-article-family', $article->id_355, $this->request->input('lang')); CustomFieldResultLibrary::storeCustomFieldResults($this->request, $article->field_group_id_351, 'cms-article-family', $article->id_355, $this->request->input('lang')); } }