In this line
{!! Form::select('tag_list[]',$tags,null,['class'=>'form-control','multiple']) !!}
the third parameter of the select() method should contain the default value(s) of the select. You're passing null so there are no default values which will be selected automatically. Here you need to pass the result of your tag_list attribute so for example like this (not 100% sure if it's correct):
{!! Form::select('tag_list[]',$tags, $cat->tag_list ,['class'=>'form-control','multiple']) !!}
But at 12'06 of the video, Jeff says it can be null, the form model binding will take care that. I am confused, don't know what is wrong.
I have figured out the problems,
$this->tags->lists('id')
return a collection,
we need to cast it to array, so
$this->tags->lists('id')->toArray()
will work.
I think the newest laravel changed the returned value type.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community