Hi!
I'm trying to filter my dropdowns through the 'dependsOn' feature in my fields.yaml. After 3 hours of trying I figured out through some forum posts and looking at Rainlab's User plugin -> Country /state filtering, that the way the docs explain filtering is no longer functioning.
At this point my dropdowns do update when the dependency is updated, but I can't get the value of the dependency in my controller. The docs say:
$this->*fieldname* but that doesn't work.
Code example below:
fields:
poule:
label: rebel59.matchmaking::lang.matches.poule
type: dropdown
home_team_id:
label: rebel59.matchmaking::lang.matches.home_team
type: dropdown
dependsOn: poule
Model:
public function getPouleOptions()
{
return Poule::getNameList();
}
public function getHomeTeamIdOptions()
{
return Team::getNameList($this->poule);
}
The value of $this->poule is zilch.
Anybody know what I'm doing wrong?
Update as requested:
Poule.php (Model)
public static function getNameList()
{
return self::all()->lists('name', 'id');
}
Team.php (Model)
public static function getNameList($pouleId)
{
return self::where('poule_id',$pouleId)->lists('name', 'id');
}
Last updated