'required', 'client_designation_company_name' => 'required', 'description' => 'required', ]; } public function messages(){ return [ 'required' => 'The :attribute field is required.', ]; } public function validated() { $testimonials = Testimonial::find($this->testimonial_id); $image = basename($testimonials->client_image); if($this->client_images === 'male.jpg' || $this->client_images === 'female.png'){ $image = $this->client_images; } if($this->client_images === "One"){ if($this->has('client_images_one')){ if (\File::exists(public_path('/uploads/testimonials/images/' . $testimonials->client_image . ''))) { \File::delete(public_path('/uploads/testimonials/images/' . $testimonials->client_image . '')); } $image = time() . '.' . $this->client_images_one->extension(); $this->client_images_one->move(public_path('/uploads/testimonials/images'), $image); } } return array_merge(parent::validated(), [ 'rating' => $this->rating, 'client_image' => $image ]); } }