Laravel Request Validate

public function store(Request $request)
    {

        $data = $request->validate([
            'status'=>'required',
            'name'=>'required|max:20',
            'address_designation'=>'required|max:20',
            'testimonial'=>'required|min:5|max:200',
            'image'=>'required',
        ],[
            'name.max' => "Name must not exceed 10 character",
            'address_designation.max' => "Address/Designation must not exceed 10 character",
            'testimonial.max' => "Testimonial must be written in between 5 to 200 characters",
        ]);
}

Leave a Reply

Your email address will not be published. Required fields are marked *