誰か、フィルターを手伝ってください。私は 3 つのテーブルを持っています: 苦情、frontend_tag、frontendtags_complaints
ここに私のフィルターコードがあります:
$this->crud->addFilter([
'name' => 'frontendtags',
'type' => 'select2',
'label'=> 'FE Tag'
], function() {
return \App\Models\FrontendTags::all()->pluck('name', 'id')->toArray();
}, function($value) {
return $this->crud->query->whereHas('frontendtags', function ($q) use ($value) {
$q->where('tag_id', $value);
});
});
ここに私の関係コードがあります:
public function frontendtags()
{
return $this->belongsToMany('App\Models\FrontendTags', 'frontendtags_complaints', 'complaint_id', 'tag_id');
}
フィルターが機能していません。