Php 参数不匹配,模式是字符串,而替换是在表单中插入标记时的数组错误

Php 参数不匹配,模式是字符串,而替换是在表单中插入标记时的数组错误,php,pivot,relationship,laravel-routing,Php,Pivot,Relationship,Laravel Routing,我正在数组中使用表单中的标记。插入时,错误显示为: preg_replace():参数不匹配,模式为字符串,而替换为数组 我的代码: 查看页面 <div class="form-group"> <label>TAGS</label><br> {!! Form::select('tags[]',$tags,null,['id'=>'tag_id','class'=>'form-control',

我正在数组中使用表单中的标记。插入时,错误显示为: preg_replace():参数不匹配,模式为字符串,而替换为数组

我的代码:

查看页面

<div class="form-group">
           <label>TAGS</label><br>
           {!! Form::select('tags[]',$tags,null,['id'=>'tag_id','class'=>'form-control','multiple']) !!}
        </div>
} 我正在使用多对多关系和数据透视表。。 有什么办法可以解决这个问题吗

 $newPortfolio = $portfolio->create(
        array(
            "first_name" => $request->input('first_name'),

        ));

    $tags = $request->input('tags');

    $newPortfolio->tags()->attach($tags);