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?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/32x3wca
via IFTTT

تعليقات

المشاركات الشائعة من هذه المدونة

I am unable to figure out how to create payment collection request, after a form has been submitted in laravel

laravel, mysql transaction not working after failed one time