lundi 30 novembre 2015

Laravel Validation between not converting comma separated string to array?

Just trying to do some tags validation. First checking for number of tags (as comma separated list of id's).

class SomePostRequest extends Request
{
    public function rules()
    {
        return [
            'tags' => 'between:2,5'
        ];
    }


    public function all()
    {
        $input = parent::all();

        $input['tags'] = explode(',', @$input['tags']);

        return $input;
    }

}

It keeps spititing out the message as

The tags must be between 2 and 5 characters.

Instead of the proper array message:

The :attribute must have between :min and :max items.



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

Aucun commentaire:

Enregistrer un commentaire