Can someone please shine some light on the following?
$partners = Db::table('mod_partner')
->select('*')
// get entries from country table, even if no country code was set in partner table.
->join('country', 'mod_partner.mod_partner_countrycode = country.country_iso', 'LEFT JOIN')
->where('mod_partner.mod_partner_status = 1')
->order('mod_partner.mod_partner_id DESC');
dump($partners->all()) // 36 results
dump($partners->all()) // 55 results
Why is the result changing?
What is all() doing here? Am I using it wrong?
I was under the impression that I can get the whole record set with all() (which works once)
I’m having a hard time to understand Kirby’s collections with db queries.
Any hint is much appreciated.
Edit:
This is how I would use the data:
$partnersMap = $partners->all()->map(
function ($item) {
return [
'fillKey' => 'ACTIVE',
'company' => $item->mod_partner_company(),
'country_iso' => $item->country_iso(),
'country_iso3' => $item->country_iso3(),
'country' => $item->mod_partner_country(),
];
}