Costumize AttachAction

I have a relation manager in a Laravel Filament V3 app. It manages the relation between my Project model and my Attendee model. They are connected through a pivot table and a BelongsToMany relationship. When i add the AttachAction in the header i want to be able to search my projects by name but the name is not on the Project model itself. The name is set on a Course model which is connected trough a HasMany / BelongsTo relationship.
public function table(Table $table): Table
{
return $table
->recordTitleAttribute('id')
->columns([
TextColumn::make('course.title')
->label('Cursus')
->sortable(),
TextColumn::make('start_datetime')
->label('Datum')
->date('d-m-Y')
->sortable()
])
->headerActions([
Tables\Actions\AttachAction::make()
->recordSelectSearchColumns(['start_datetime', 'course.title']),
])
->actions([
Tables\Actions\EditAction::make()->slideOver(),
Tables\Actions\DeleteAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}
}
public function table(Table $table): Table
{
return $table
->recordTitleAttribute('id')
->columns([
TextColumn::make('course.title')
->label('Cursus')
->sortable(),
TextColumn::make('start_datetime')
->label('Datum')
->date('d-m-Y')
->sortable()
])
->headerActions([
Tables\Actions\AttachAction::make()
->recordSelectSearchColumns(['start_datetime', 'course.title']),
])
->actions([
Tables\Actions\EditAction::make()->slideOver(),
Tables\Actions\DeleteAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}
}
I've tried to do this. The TextColumn gives the title of the course but the AttachAction does not work: Unknown column 'course.title' in 'where clause'
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server