Support the ongoing development of Laravel.io →
posted 9 years ago
Eloquent
Last updated 2 years ago.
0

You have to use eloquent join method

$departments = Department::select('departments.*')
  ->join('department_categories', 'department_categories.department_id', '=', 'departments.id')
  ->join('department_tags', 'deparment_tags.department_id', '=', 'departments.id')
  ->where('department_categories.categorie_type_id', '=', $category_type_id)
  ->where('department_tags.tag_type_id', '=', $tag_type_id)
  ->get();
Last updated 2 years ago.
0

Thanks so far so good. How does it look if i have plenty tags? In this solution i can only ask for one.

Last updated 2 years ago.
0
Solution
$query->whereIn('department_tags.tag_type_id', $tag_ids_array);
Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Tuturials tuturials Joined 11 Jul 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.