erikms61
erikms61
FFilament
Created by erikms61 on 11/22/2023 in #❓┊help
Column search with Select
Hi Filament wizards, Can we use a Select as a column search? I know we can use a Filter... but can we do it with a Select? I can't find anything in the documentation about this. Since we have a relatively small number of user groups, and the current search would require the user to type in the name; a Select would let them ... select. something like:
public static function table(Table $table): Table
{
return $table
->columns([
TextColumn::make('UserGroup.name')
->searchable(isIndividual:true, isGlobal:false)
*->useSelect('...')->options(UserGroup::all()->pluck('name','id')*
public static function table(Table $table): Table
{
return $table
->columns([
TextColumn::make('UserGroup.name')
->searchable(isIndividual:true, isGlobal:false)
*->useSelect('...')->options(UserGroup::all()->pluck('name','id')*
2 replies
FFilament
Created by erikms61 on 11/10/2023 in #❓┊help
Reused form fields do not seem to follow model relationships
Hi all, I am trying to open a form defined in one Resource, via an action in another Resource. This does not work if a field uses a relationship. For a test, I created a fresh install with two Models: Een and Twee, where Twee contains a reference to Een. Will put it on Github if needed. The Resources contain a TextInput each, and TweeResource contains a Select to select the referenced Een. This works fine while in the Twee Admin page. The problem arises when I try to open the Twee form in the Een Admin page via an Action. The error is "Filament\Support\Services\RelationshipJoiner::prepareQueryForNoConstraints(): Argument #1 ($relationship) must be of type Illuminate\Database\Eloquent\Relations\Relation, null given, called in ... vendor/filament/forms/src/Components/Select.php on line 770" Questions: - what am I doing wrong? - How should I indicate that there is a relation between Twee and Een? - I would assume that the form definition takes care of that... shouldn't it? (2000 character limit, code in attachment)
3 replies