//TestRequest.php
public function rules()
{
return [
'name' => 'string|required|min:5',
'tip' => 'string|required|min:5',
'answer' => 'string|required',
'image' => 'file|required|mimes:png,jpg,jpeg'
];
}
//TestController.php
public function put(TestRequest $request)
{
$validated = $request->validated();
}
I'm doing some rest API. I need a form with some text fields and one image upload field but I have a problem with validating it.
When I'm sending the request as 'form-data' in the Postman, Laravel doesn't see in the validation any fields (why?).
When I'm sending the request as
application/x-www-form-urlencodedLaravel sees my text fields, but I can't, of course, upload the image.
API will be used by the android APP. How I can solve this? How I can have both validation on text and file inputs?

