has('code')) { $this->merge([ 'code' => strtoupper($this->input('code')), ]); } } /** * Get the validation rules that apply to the request. * * @return array|string> */ public function rules(): array { return [ 'name' => [ 'required', 'string', 'max:150' ], 'city' => [ 'required', 'string', 'max:100' ], 'province' => [ 'required', 'string', 'max:100' ], 'code' => [ 'required', 'string', 'max:10' ], ]; } public function attributes(): array { return [ 'name' => 'نام فرودگاه', 'city' => 'شهر', 'country' => 'کشور', 'code' => 'کد فرودگاه', ]; } // public function messages(): array // { // return [ // 'name.required' => 'نام فرودگاه الزامی است.', // 'name.max' => 'نام فرودگاه حداکثر ۱۵۰ کاراکتر باشد.', // 'city.required' => 'نام شهر الزامی است.', // 'city.max' => 'نام شهر حداکثر ۱۰۰ کاراکتر باشد.', // 'country.required' => 'نام کشور الزامی است.', // 'country.max' => 'نام کشور حداکثر ۱۰۰ کاراکتر باشد.', // 'code.required' => 'کد فرودگاه (IATA) الزامی است.', // 'code.max' => 'کد فرودگاه حداکثر ۱۰ کاراکتر باشد.', // ]; // } }