samedi 16 janvier 2016

laravel validate html select

I've got a section list in my viewlike this:

        <select name="departments">
                        <option value="1">support 1</option>
                        <option value="2">support 2</option>               
         </select>

Now I would like to check if the "option value" is in my database, so users cannot sent an incorrect number of support department. How can I access the "value" in my validator?

$validator = Validator::make($request->all(), [
    'how to access the value?!' => 'required|exists:departments,id',
    ]);



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire