无法从复选框中的控制器获取标签
在Controller
:
$tags = Tag::pluck('name','id')->all();
return view('admin.posts.create', compact('categories','tags'));
在view
:
{!! Form::label('tag_id','Select Tag') !!}
{!! Form::checkbox('tags[]',$tags,false,['class'=>'form-control']) !!}
您需要遍历标签
@foreach($tags as $tag)
{!! Form::checkbox('tags[]', $tag->id, ['class'=>'form-control']) !!}
{!! Form::label('tags', $tag->name) !!}
@endforeach
希望它有帮助。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句