I am working on small scale CMS for a project with tables like so:
- pages
- id
…
- translations
- page_id
…
- menus
- id
…
- menu_page
- menu_id
- page_id
…
In the Menu model I have this relationship:
function pages(){
return $this->hasMany('Page');
}
Is it possible to create a relation directly between Menu and Translations that translates to something like this SQL query:
select translations.*
from translations
inner join menu_page on menu_page.page_id = translations.page_id
where menu_page.menu_id = ?;
Thanks!
See Question&Answers more detail:os