lundi 9 novembre 2020

How do i pass an eloquent collection to a validation rule?

I have this rule:

Validator::make($data, [
    'category' => [
        'required',
        Rule::notIn(['news', 'article']),
    ],
]);

The problem is that news and article are stored in another table. How do i pass the the data from that table into notIn instead?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire