I have created a simple function in App\Traits\Validate.
This function simply validates image as seen.
public function validate_image($request)
{
$check = true;
$validate = $this->validate($request, [
'image' => 'image|mimes:jpeg,png,jpg|max:2048',
]);
dd($validate);
if($validate->fails())
{
$check = false;
}
return $check;
}
Now when I access this function in Controller through
$check_image = $this->validate_image($request);
I am passing the whole request variable. But still in validate_image function I am getting null. What is that I am missing? I have other functions in Validate trait and those are working fine, but this function returning null value. Please help
And yess image is the name of the file field in form
dd($validate)in your function as well ?dd($validate). And you have multiple field from where images are uploaded. Am I right ?