title: laravel Object of class stdClass could not be converted to string
body: <p>i have permissions for this role and other permission that this role don't have i want to display both permission in this role and other ones in the same page separated heres index in my controller</p>
  
  <pre><code>public function index(Request $request , $id,$permission_id)
  {
      $rolepermission =DB::table('permission_role')
          -&gt;join('permissions', 'permissions.id', '=', 'permission_role.permission_id')
          -&gt;where('permission_role.role_id' , $id)
          -&gt;get();
  
      $rolepermissiongetid =DB::table('permission_role')-&gt;select('role_id')
          -&gt;where('permission_role.role_id' , $id)
          -&gt;get();
  
      $notrolepermision =DB::table('permission_role')
          -&gt;join('permissions', 'permissions.id', '=', 'permission_role.permission_id')
          -&gt;whereNotIn('permission_role.role_id' ,$rolepermissiongetid)
          -&gt;get();
  
  
  
      $nodata = '';
      if($rolepermission==null){
          $nodata="This Roles Does Not Have Permissions";
      }
  
      $role=DB::table('roles')-&gt;where('id' ,$id)-&gt;first();
  
      return view('managements.role-permission-list')
          -&gt;with('role' ,$role)
          -&gt;with('data' , $rolepermission)
          -&gt;with('role2', $notrolepermision)
          -&gt;with('nodata' , $nodata)
          -&gt;with('role_id' ,$id);
  }
  </code></pre>
  
  <p>but i keep getting  Object of class stdClass could not be converted to string,</p>
  
  <p>i did foreach to get the data in my view</p>
  
  <pre><code>&lt;div class="row"&gt;
      &lt;div class="col-lg-12"&gt;
          &lt;div class="panel panel-default"&gt;
              @foreach($role2 as $role2s)
                  &lt;button class="btn btn-primary"&gt;{{$role2s-&gt;name}}&lt;/button&gt;
  
               @endforeach
  
              &lt;!-- /.panel-heading --&gt;
              &lt;div class="panel-body"&gt;
          @if(isset($success_alert))
              &lt;div class="alert alert-success"&gt;{{$success_alert}}&lt;/div&gt;
          @endif
          @if(isset($danger_alert))
              &lt;div class="alert alert-danger"&gt;{{$danger_alert}}&lt;/div&gt;
          @endif
  
  
              @foreach($data as $dat)
  
  
                  &lt;div class="col-lg-3"&gt;
                      &lt;button class="btn btn-default"&gt;{{$dat-&gt;name}}&lt;/button&gt;
                      &lt;hr&gt;
                  &lt;/div&gt;
  
  
                &lt;!--      &lt;td&gt;
                          &lt;a href='/role-permission-confirm-delete/{{$dat-&gt;role_id}}/{{$dat-&gt;permission_id}}' class='btn btn-danger'&gt;&lt;i class='fa fa-close'&gt;&lt;/i&gt; Delete&lt;/a&gt;
  
                         &lt;!-- &lt;a href='/role-permission/{{$dat-&gt;role_id}}/{{$dat-&gt;permission_id}}' class='btn btn-warning confirm'&gt; View &lt;/a&gt;
                      &lt;/td&gt;--&gt;
  
              @endforeach
  
  
          &lt;!-- /.table-responsive --&gt;
  
      &lt;/div&gt;
          &lt;/div&gt;
     &lt;!-- &lt;a href="/role-permission/create/{{$role-&gt;id}}" class="btn btn-primary"&gt;
          &lt;i class="fa fa-plus"&gt;&lt;/i&gt; New Permission
      &lt;/a&gt; --&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>this im getting with the error </p>
  
  <blockquote>
    <p>Object of class stdClass could not be converted to string
    in RolePermissionsController.php line 32
    at HandleExceptions->handleError('8', 'Trying to get property of non-object', 'C:\xampp\htdocs\terkwazmng\app\Http\Controllers\RolePermissionsController.php', '32', array('role_id' => '1', 'rolepermission' => array(object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass)), 'rolepermissiongetid' => array(object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass)))) in RolePermissionsController.php line 32</p>
  </blockquote>