F
Filamentβ€’15mo ago
Arko

TextInputColumn $get

I'm creating a table that allows inline editing using TextInputColumn'. I would like to get a previous fields value in order to do some db updating:
TextInputColumn::make($date . '_revenue')
->label('Aantal')
->placeholder('0'),
TextInputColumn::make($date)
->placeholder('0.00')
->updateStateUsing(function ($state, Get $get, ProjectCostDay $model) use ($date) {
ray($get($date . '_revenue'));

return $state;
}),
TextInputColumn::make($date . '_revenue')
->label('Aantal')
->placeholder('0'),
TextInputColumn::make($date)
->placeholder('0.00')
->updateStateUsing(function ($state, Get $get, ProjectCostDay $model) use ($date) {
ray($get($date . '_revenue'));

return $state;
}),
I'm probably misusing $get here, but I can't wrap my head around it.
4 Replies
LeandroFerreira
LeandroFerreiraβ€’15mo ago
$record ?
Arko
ArkoOPβ€’15mo ago
Keep in mind that I'm dumb, what do you mean? πŸ˜„ For what its worth, the input's value I want to get is not a database column, its just an input value that I need to use on the second input in order to do a database insert. So basically I'm trying to 'collect' 2 input's values before doing anything with my database (can't do much with both values separately)
Arko
ArkoOPβ€’15mo ago
It's a lot of data the user has to input, so kinda want to have it all in one table so they can just Tab through it. I could do something like this instead of using $get:
TextInputColumn::make($date . '_revenue')
->label('Aantal')
->updateStateUsing(function ($state, Get $get, ProjectProduct $model) use ($date) {
$this->state['dates'][$date][$model->name]['amount'] = $state;

return $state;
})
->placeholder('0'),
TextInputColumn::make($date)
->placeholder('0.00')
->updateStateUsing(function ($state, Get $get, ProjectProduct $model) use ($date) {
ray($this->state['dates'][$date][$model->name]['amount']);

return $state;
}),
TextInputColumn::make($date . '_revenue')
->label('Aantal')
->updateStateUsing(function ($state, Get $get, ProjectProduct $model) use ($date) {
$this->state['dates'][$date][$model->name]['amount'] = $state;

return $state;
})
->placeholder('0'),
TextInputColumn::make($date)
->placeholder('0.00')
->updateStateUsing(function ($state, Get $get, ProjectProduct $model) use ($date) {
ray($this->state['dates'][$date][$model->name]['amount']);

return $state;
}),
Think, since what I'm building is kinda dumb in terms of Filament nativeness, this is the way to go for me. Unless you have a good idea πŸ˜„
Want results from more Discord servers?
Add your server