This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Hey, I have a view which making new concert. I want to choose from user table only those users who are in producer group. Didnt find any doc for such relation/filter
Can anyone advice? I feel that ist easy, but cannot figure it out.
thanks
Take a look at the RainLab.User plugin, it has an example of filtering the users by group.
in field.yaml
producer:
label: producer
type: recordfinder
list: $/rainlab/user/models/user/columns.yaml
prompt: Click the %s button to find a hall
nameFrom: name
concert.model
public $belongsTo = [
'producer' => [
'RainLab\User\Models\User',
'conditions' => 'group' = 1 //not working
],
];
where do I add the condition?
can you please point me into some direction? (more specific ) ) thanks
Last updated
do you mean in config_filter.yaml
scope: filterByGroup
and
public function scopeFilterByGroup($query, $filter)
{
return $query->whereHas('groups', function($group) use ($filter) {
$group->whereIn('id', $filter);
});
}
Last updated
AlexeiKo said:
do you mean in config_filter.yaml
scope: filterByGroup
and
public function scopeFilterByGroup($query, $filter) { return $query->whereHas('groups', function($group) use ($filter) { $group->whereIn('id', $filter); }); }
Thanks i was looking for this
1-6 of 6