Using TextInputColumn in Table with custom data , get this error
Filament\Tables\Columns\Column::hasRelationship(): Argument #1 ($record) must be of type Illuminate\Database\Eloquent\Model, array given
2 Replies
Please share your code.
I guess the all the InputColumns won't work out of the box. You don't have a model, so what should they update?
You can use
->updateStateUsing() to overwrite the default behaviourpublic function table(Table $table): Table
{
return $table
->emptyStateHeading('No hay empleados')
->records(fn() => $this->empleados)
->columns([
TextColumn::make('id'),
TextColumn::make('codigo'),
TextColumn::make('nombre'),
TextColumn::make('puesto'),
TextInputColumn::make('dias')
->updateStateUsing(function ($state, $record) {
$this->empleados[$record['__key']]['dias'] = $state;
}),
])
->filters([
// ...
])
->recordActions([
// ...
])
->toolbarActions([
// ...
])
;
}
Thank you very much for the advice, it helped me a lot.