vendredi 30 septembre 2016

Unable to get an array from register form Laravel 5.3

I'm using Laravel 5.3 auth:make registration form, I have a multiple select in my form, which returns the count of the selected rows instead of array with the values.

Thats what coming back when I dd($data):

 array:10 [▼
      "_token" => "mBTBYC4yHsI0Ph1Hmj7p6MSstOCRM3cDkCoSZH4b"
      "first_name" => "User"
      "last_name" => "Family"
      "class" => "Software Engineer"
      "year" => "0"
      "tags" => "1" -> that should be an array.
      "phone" => "55555555"
      "email" => "test@test.com"
      "password" => "123123"
      "password_confirmation" => "123123"
    ]

The are I would like to fix looks like this in the html:

<div class="form-group">
    {!! Form::select('tags[]', $tags , null , ['class' => 'form-control' , 'multiple' , 'id'=>'tags' , 'name' => 'tags']) !!}
    @if ($errors->has('tags'))
        <span class="help-block">
            <strong></strong>
        </span>
    @endif
</div>



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire