Laravel Undefined property: stdClass :: multimedia

1

I have a query, I have an error when returning a foreign key in the view.

Controller (the function I'm using)

public function busqueda()
{
   $user = Auth::user();
   $propiedad = DB::table('propiedad')
          ->join ('multimedia', 'multimedia.id_propiedad', '=', 'propiedad.id_propiedad' )
          ->orderBy('propiedad.id_propiedad', 'asc')
          ->get();

   return view('inquilino/propiedades', compact('user', 'propiedad'));
}

View

@if($propiedad->count())
   @foreach($propiedad as $key=>$prop)

   <tr>
      <td>{{$key+1}}</td>
      <td>{{$prop->multimedia->nombre}}</td> -->Aqui me sale el error
      <td>{{$prop->ciudad}}</td>
      <td>{{$prop->zona}}</td>
      <td>{{$prop->descripcion}}</td>
      <td>{{$prop->costo}}</td>
      <!--<td><a class="btn btn-warning" href="{{action('InquilinoController@busqueda_prop', $prop->id_propiedad)}}" ></a></td>-->
   </tr>

   @endforeach
@else
@endif

The error comes to me in the view, I do not have much experience in Laravel, I would like to be able to make a list of 2 tables, as I investigate to do this, I need to use the models but in my case I am not using eloquent and I would like know how Query Builder would be used.

    
asked by Daniel Gironás 14.11.2018 в 21:49
source

0 answers