/** * Get the validation rules that apply to the request. * * @return array */ public function rules(Locale $locale) { //only for next request:: ->flash //session()->flash('active_language_tab',$request->get('active_language_tab')); // $locales = new Locale(); § $locales = $locale->getEnabled(); $sitemapRules = ['parent_id' => 'required', 'online' => 'required', 'template_id' => 'required']; $translationRules = array(); foreach ($locales as $key => $locale) { $translationRules['translations.' . $locale->languageCode . '.name'] = 'required'; //homepage geen slug , patch is update if (request()->get('parent_id') != 0 && request()->get('_method') == 'PATCH') { $translationRules['translations.' . $locale->languageCode . '.slug'] = 'required'; //dc('wel verplicht'); } else { //dc('niet verplicht'); } switch ($this->input('post_type')) { case 'homepage': //$translationRules['translations.'.$locale->identifier.'.news.author'] = 'required|integer'; //uit //$translationRules['translations.'.$locale->languageCode.'.homepage.content'] = 'required'; break; case 'defaultpage-uit': $translationRules['translations.' . $locale->languageCode . '.defaultpage.content'] = 'required'; break; default: } } return array_merge($sitemapRules, $translationRules); }
/** * Get the validation rules that apply to the request. * * @return array */ public function rules(Locale $locale) { $locales = $locale->getEnabled(); $referenceRules = ['referencetype_id' => 'required']; $translationRules = array(); foreach ($locales as $key => $locale) { $translationRules['translations.' . $locale->languageCode . '.name'] = 'required'; /* switch ($this->input('post_type')) { case 'homepage': //$translationRules['translations.'.$locale->identifier.'.news.author'] = 'required|integer'; //uit //$translationRules['translations.'.$locale->languageCode.'.homepage.content'] = 'required'; break; case 'defaultpage': $translationRules['translations.'.$locale->languageCode.'.defaultpage.content'] = 'required'; break; default: } */ } return array_merge($referenceRules, $translationRules); }