app/maguttiCms/Admin/Controllers/AjaxController.php
/**
	* This method is used to save the edit data
	*/
This method is used to save the edit data
This method is used to save the edit data
public function updateFileManager($id, Request $request)
	{
		$article = Media::find($id);
		$this->request = $request;
		foreach ($article->getFillable() as $a) {
			$article->$a = $this->request->get($a);
		}
		$article->save();
		if (isset($article->translatedAttributes) && count($article->translatedAttributes) > 0) {
			foreach (config('app.locales') as $locale => $value) {
				foreach ($article->translatedAttributes as $attribute) {
					if (isset($article->sluggable) && $this->attributeIsSluggable($attribute, $article->sluggable)) {
						$attribute_to_slug = (config('app.locale') != $locale) ? $attribute.'_' . $locale:$attribute;
						$string_value      = $this->setSlugAttributes($a)
						->sluggyTranslatable($article, $this->request->get($attribute_to_slug), $locale);
						$article->translateOrNew($locale)->$attribute = $string_value;
					} else {
						if (config('app.locale') != $locale) {
							$article->translateOrNew($locale)->$attribute = $this->request->get($attribute . '_' . $locale);
						} else {
							$article->translateOrNew($locale)->$attribute = $this->request->get($attribute);
						}
					}
				}
				$article->save();
			}
		}
		$this->responseContainer['status'] = 'ok';
		$this->responseContainer['message'] = 'Data has been updated';
		return $this->responseHandler();
	}
public function updateFileManager ( $ id , Request $ request ) { $ article = Media :: find ( $ id ) ; $ this -> request = $ request ; foreach ( $ article -> getFillable ( ) as $ a ) { $ article -> $ a = $ this -> request -> get ( $ a ) ; } $ article -> save ( ) ; if ( isset ( $ article -> translatedAttributes ) && count ( $ article -> translatedAttributes ) > 0 ) { foreach ( config ( 'app.locales' ) as $ locale => $ value ) { foreach ( $ article -> translatedAttributes as $ attribute ) { if ( isset ( $ article -> sluggable ) && $ this -> attributeIsSluggable ( $ attribute , $ article -> sluggable ) ) { $ attribute_to_slug = ( config ( 'app.locale' ) != $ locale ) ? $ attribute . '_' . $ locale : $ attribute ; $ string_value = $ this -> setSlugAttributes ( $ a ) -> sluggyTranslatable ( $ article , $ this -> request -> get ( $ attribute_to_slug ) , $ locale ) ; $ article -> translateOrNew ( $ locale ) -> $ attribute = $ string_value ; } else { if ( config ( 'app.locale' ) != $ locale ) { $ article -> translateOrNew ( $ locale ) -> $ attribute = $ this -> request -> get ( $ attribute . '_' . $ locale ) ; } else { $ article -> translateOrNew ( $ locale ) -> $ attribute = $ this -> request -> get ( $ attribute ) ; } } } $ article -> save ( ) ; } } $ this -> responseContainer [ 'status' ] = 'ok' ; $ this -> responseContainer [ 'message' ] = 'Data has been updated' ; return $ this -> responseHandler ( ) ; }
This method is used to save the edit data
This method is used to save the edit data
// translatable // se è un attributo sluggabile;