title: ErrorException (E_ERROR) rawurlencode() expects parameter 1 to be string, object given
body: <p>A trying to display data from two tables and am getting the above error message, can somebody help translate this error message?
  Here is the Controller</p>
  
  <pre><code>public function index()
  {
    $maintenances = DB::table('tenants')-&gt;select('tenants.lastname','tenants.firstname','maintenances.m_status','tenants.designation',      'maintenances.description','maintenances.building_section','maintenances.category','maintenances.reported_date')
          -&gt;join('maintenances','maintenances.tenants_id','=','tenants.id')
          -&gt;get();
      //dd($maintenances);
      return view('agent/maintenance_list', compact('maintenances', 'assetTenants', 'tenants'));
  }
  </code></pre>
  
  <p>And view</p>
  
  <pre><code>@foreach($maintenances as $maintenance)
                &lt;tr&gt;
                  &lt;td class="text-center"&gt;
                    &lt;div class="checkbox-custom"&gt;
                      &lt;input id="product-01" type="checkbox" value="01"&gt;
                      &lt;label for="product-01" class="pl-0"&gt;&amp;nbsp;&lt;/label&gt;
                    &lt;/div&gt;
                  &lt;/td&gt;
                  &lt;td&gt;{{ $maintenance-&gt;designation }} {{ $maintenance-&gt;firstname }} {{ $maintenance-&gt;lastname }}&lt;/td&gt;
                  &lt;td&gt;{{ $maintenance-&gt;category }}&lt;/td&gt;
                  &lt;td&gt;{{ $maintenance-&gt;building_section }}&lt;/td&gt;
                  &lt;td&gt;{{ $maintenance-&gt;description }}&lt;/td&gt;
                  &lt;td&gt;{{ $maintenance-&gt;reported_date }}&lt;/td&gt;
                  &lt;td&gt;{{ $maintenance-&gt;m_status }}&lt;/td&gt;
                  &lt;td class="text-center"&gt;
                    &lt;div role="group" aria-label="Basic example" class="btn-group btn-group-sm"&gt;
                      &lt;a href="{{ url('agent/edit_maintenance', $maintenance }}" type="button" class="btn btn-outline btn-success"&gt;&lt;i class="ti-pencil"&gt;&lt;/i&gt;&lt;/a&gt;
                    &lt;/div&gt;
                  &lt;/td&gt;
                &lt;/tr&gt;
                @endforeach
  </code></pre>
  
  <p>With the route</p>
  
  <pre><code>Route::get('maintenance_list', 'MaintenanceController@index')-&gt;name('/maintenance_list');
  </code></pre>
  
  <p>However, I noticed that once I remove the $maintenance variable from the url edit button, the page displays well. What can be the issue, for I don't understand the error message in the list</p>