mardi 31 décembre 2019

Laravel validation for exists except zero not nullable

In categories table I have the following columns id, parent_id, title

Now, parent_id is the parent category for sub-category, but for the root/primary categories parent_id is 0 because they have no parent!

<?php
'parent_id'=>'required|exists:categories,id|nullable' 
// wont work, because parent_id = 0

I used also [sometimes] with no luck!



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

Aucun commentaire:

Enregistrer un commentaire