mardi 6 mars 2018

Laravel validation Using Closures

Developing with Laravel 5.4 I am trying the example from Laravel documentation:

$validator = Validator::make($request->all(), [
'title' => [
    'required',
    'max:255',
    function($attribute, $value, $fail) {
        if ($value === 'foo') {
            return $fail($attribute.' is invalid.');
        }
    },
],

]);

I am getting this error:

Object of class Closure could not be converted to string

Why?



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

Aucun commentaire:

Enregistrer un commentaire