vendredi 5 février 2016

Validate if the field is entered in Laravel 5.2

public function rules() {
        return [
            'num_of_devices' => 'integer'
        ];
}

I want to validate an integer field if and only if the field is entered. But above rule validates it for integer even if the field is empty. I used somtimes, but no result. But when I var_dump($num_of_devices) it is string.I am using Laravel 5.2. I think It was working fine in 5.1. Please help me.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire