mardi 27 novembre 2018

Adding Joins And To Laravel Eager Loading Method

I'm calling the eager loading method ::with() on my model users_saved like this:

$data = users_saved::with('property_info')

The code above does the job of returning the many to many relationship stored in a pivot table. Now if I wanted to add a bunch of joins to the code above, how would I go about doing that? If I run:

$data = users_saved::with('property_info')
  ->join('option_packages', 'option_packages.id', '=', 'property_infos.option_package_id')
  ->join('option_types', 'option_types.id', '=', 'option_packages.option_type_id')

I get this error returned:

SQLSTATE[42S22]: Column not found: 1054 Unknown column



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire