title: Array to string conversion in laravel 5.4 , controllers
body: <p>I'm getting array to conversion error while inserting multiple data , code which i mentioned below please take a look and somebody help me</p>
  
  <p>Controller.php</p>
  
  <pre><code>         if(!empty($value))
                  {
                      foreach ($value as $v) 
                      {   
                          $insert[] = ['name' =&gt; $v['name'], 'email' =&gt; $v['email'],'company_name' =&gt; $v['company_name'],'company_id' =&gt; $v['company_id'], 'emp_id' =&gt; $v['emp_id']];     
                           $role_id= $v['role_id'];
                           $name=$v['name'];
                           $email=$v['email'];
                           $emails[]=$v['email'];
                           $emp_id=$v['emp_id'];                      
                           $data = array( 'name' =&gt; $name,'email' =&gt; $email , 'emp_id' =&gt; $emp_id);
                           $roles[]= $v['role_id']; 
  
                      }
                  }
              }
  
              if(!empty($insert))
              {
                   $inserted=User::insert($insert);
                   if($inserted)
                   {
                       $email_select=User::select('id')-&gt;whereIn('email',$emails)-&gt;where('company_id',Auth::user()-&gt;company_id)-&gt;orderBy('id','Asc')-&gt;get();
                      foreach ($email_select as $key =&gt; $idget) 
                      {
                          $getid[]=$idget-&gt;id;
                      }
                   }
                   $datas[]=['user_id' =&gt; $getid , 'role_id' =&gt; $roles];                  
                   $insert_role=DB::table('role_user')-&gt;insert($datas) ;
  </code></pre>
  
  <p>I'm getting error called array to string conversion while insert_role variable execution</p>
  
  <blockquote>
    <p>(2/2) QueryException Array to string conversion (SQL: insert into
    <code>role_user</code> 
        (<code>role_id</code>, <code>user_id</code>) values (1, 16))</p>
  </blockquote>