timgavin's avatar

Image Array Validation

I have a form with three fields: title, body and photo[]. I'm trying to validate it so that at least one item is filled in, but I can't seem to get it to work. If I upload a file I still receive an error for title and body.

public function rules()
{
    return [
        'title' => 'required_without_all:body,photo.*',
        'body' => 'required_without_all:title,photo.*',
        'photo.*' => 'required_without_all:title,body',
        'photo.*' => 'mimes:jpeg,gif,png',
    ];
}
0 likes
0 replies

Please or to participate in this conversation.