dascorp
dascorp
FFilament
Created by dascorp on 1/3/2024 in #❓┊help
global scopes ignored on grouping
Hi, I observed that when I use https://filamentphp.com/docs/3.x/tables/grouping, the model's global scopes are not applied when a different grouping is selected, and all records are visible - I apply scopes in middleware. Is this intentional, or should I move global scopes somewhere else?
3 replies
FFilament
Created by dascorp on 5/27/2023 in #❓┊help
relationship manager on belongs to many with pivot model throws error
I have a following relation on Project::model
public function Members(): BelongsToMany
{
return $this->belongsToMany(Member::class)
->withPivot('responsibility_id')
->using(ProjectMember::class)
->with('pivot.responsibility')
->leftJoin('responsibilities', 'project_member.responsibility_id', '=', 'responsibilities.id')
->orderByPivot('responsibilities.order')
->withTimestamps();
}
public function Members(): BelongsToMany
{
return $this->belongsToMany(Member::class)
->withPivot('responsibility_id')
->using(ProjectMember::class)
->with('pivot.responsibility')
->leftJoin('responsibilities', 'project_member.responsibility_id', '=', 'responsibilities.id')
->orderByPivot('responsibilities.order')
->withTimestamps();
}
when I try to use relation manager I am getting Call to a member function newCollection() on null error note that the relationship manager works OK if Member data only from pivot table is gathered (when I comment out pivot additions/ relations)
public function Members(): BelongsToMany
{
return $this->belongsToMany(Member::class)
->withPivot('responsibility_id')
// ->using(ProjectMember::class)
// ->with('pivot.responsibility')
// ->leftJoin('responsibilities', 'project_member.responsibility_id', '=', 'responsibilities.id')
// ->orderByPivot('responsibilities.order')
->withTimestamps();
}
public function Members(): BelongsToMany
{
return $this->belongsToMany(Member::class)
->withPivot('responsibility_id')
// ->using(ProjectMember::class)
// ->with('pivot.responsibility')
// ->leftJoin('responsibilities', 'project_member.responsibility_id', '=', 'responsibilities.id')
// ->orderByPivot('responsibilities.order')
->withTimestamps();
}
2 replies