Level 13
Solved...
I had the variable declared as public.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi.
I'm just trying to get a search query back from 2 dropdowns, one is a relationship of the Module model.
Im using the '->when()' property to get the results if the query is passed through, but i can't figure out how to get it to work on the relationship.
$modules = Module::
when($this->org != '', function ($query) {
return $query->where('organisation_id', $this->org);
})
->when($this->module != '', function ($query) {
return $query->where('module_steps.module_id', $this->module);
})
->get();
I keep getting 'Property [$modules] not found on component: [modules.steps]'
Cant quite get it right. Any ideas?
Please or to participate in this conversation.