So I'm doing something like this:
$ImageCategory = ImageCategory::where('styles.id', '=', $category->id)
->leftJoin('images', 'styles.id', 'images.style_id')
->get();
And I've also tried this:
$ImageCategory = ImageCategory::leftJoin('images', 'id', 'images.style_id')->find($category->id);
Both return errors as invalid query syntax. Should work. Must I use a raw query for this to work or is there a more "eloquent" way of doing it?
Oh duh! Stupid typo. Should be:
$ImageCategory = ImageCategory::where('styles.id', '=', $category->id)
->leftJoin('images', 'styles.id', '=', 'images.style_id')
->get();
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community