© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
4 replies
ROOT-LEE

Research of null value in relation (belongs to many)

Hi✋
I have a list of users(personnes) who have a location.

personnel table : id ,id_corp,....
lieu_affectation_histories: id , personnel_id,lieu_affectation_id,...
lieu_affectaion : id , name_fr,name_ar,....

Model Personnel :
public function lieuAffectation()
    {
        return $this->belongsToMany(LieuAffectation::class, LieuAffectationHitories::class);
    }
public function lieuAffectation()
    {
        return $this->belongsToMany(LieuAffectation::class, LieuAffectationHitories::class);
    }

Personnel Ressource :

Tables\Filters\SelectFilter::make('id')
                    ->relationship('lastLieuAffectation', 'name_fr')
                    ->multiple()
                    ->label("Lieu d'affectaion")
                    ->options(
                            LieuAffectation::all()->pluck('name_fr', 'id')->toArray()
//  LieuAffectation::all()->pluck('name_fr', 'id')->prepand('null','')->toArray() 

                    ),
Tables\Filters\SelectFilter::make('id')
                    ->relationship('lastLieuAffectation', 'name_fr')
                    ->multiple()
                    ->label("Lieu d'affectaion")
                    ->options(
                            LieuAffectation::all()->pluck('name_fr', 'id')->toArray()
//  LieuAffectation::all()->pluck('name_fr', 'id')->prepand('null','')->toArray() 

                    ),

**What I'm looking for, is a search of all personnel who don't have a location.
Thanks.
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Belongs to many showing error
FilamentFFilament / ❓┊help
2y ago
Many to Many Relation
FilamentFFilament / ❓┊help
2y ago
sushi many to many relation manager
FilamentFFilament / ❓┊help
2y ago