SELECT `pages`.*
FROM (`pages`)
WHERE (
`pages`.`order` = 0
AND `pages`.`visible` = 1
)
AND
`pages`.`site_id` = 4
... which is correct.
Then I do the following, to get all pages for the site (to build a navigation list) ...
Code:
$pages = $s->page->where('visible', 1)->get();
... and the SQL is ...
Code:
SELECT *
FROM (`pages`)
WHERE `pages`.`visible` = 1
... the where clause for the site_id seems to be missing, so all pages for all sites get returned!
Am I doing something wrong, do I need to reset something before running the 2nd query? Strangely if I swap the order of the two calls the 2nd always misses out the site_id where clause.