dimanche 21 octobre 2018

Why is_null does not work when validating a date type entry in a laravel request

I try to validate if a request parameter is not null but it does not work, enter the else condition What is the problem?

if (! is_null($request->datestart) && ! is_null($request->dateend)) {
    return 'This 1';
}
else {
    return 'This 2';
}

should enter the if and return This 1 but returns This 2

My request return $request->all();

{
 "_token": "mytoken",
 "datestart": null,
 "dateend": null
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire