F
Filament16mo ago
Zakhaev

Relation with where id check doesnt work like i want it

I have this piece of code that allows searching all the assets
Select::make('asset_id')
->label('Selecteer aan middel')
->searchable([
'name','identifier'
])
->relationship('asset','full_name')
Select::make('asset_id')
->label('Selecteer aan middel')
->searchable([
'name','identifier'
])
->relationship('asset','full_name')
but now i want them filtered on a organisation_id this is what i did in the model.
public function asset()
{
return $this->belongsTo(Asset::class)->where('organisation_id', Filament::auth()->user()->organisation_id);
}
public function asset()
{
return $this->belongsTo(Asset::class)->where('organisation_id', Filament::auth()->user()->organisation_id);
}
but when i check it with Telescope i see that the organisation_id check is never performed. Anyone tips for me ?
Solution:
Stack Overflow
Showing relational data of a Filament resource
I've started using Filament PHP for creating a Laravel based intranet application but stumbled across a question I couldn't answer myself using the official documentation: What's the easiest way to...
Jump to solution
1 Reply
Solution
Zakhaev
Zakhaev16mo ago
Stack Overflow
Showing relational data of a Filament resource
I've started using Filament PHP for creating a Laravel based intranet application but stumbled across a question I couldn't answer myself using the official documentation: What's the easiest way to...
Want results from more Discord servers?
Add your server