TextInputColumn::make('am_amount')
->label('AM')
->getStateUsing(function (Model $record) {
return $record->forecastValues()->where('day', 'sunday')->first()?->am_amount;
})->beforeStateUpdated(function ($record, $state) {
$value = $record->forecastValues()->where('day', 'sunday')->first();
$value->am_amount = $state;
$value->save();
})
TextInputColumn::make('am_amount')
->label('AM')
->getStateUsing(function (Model $record) {
return $record->forecastValues()->where('day', 'sunday')->first()?->am_amount;
})->beforeStateUpdated(function ($record, $state) {
$value = $record->forecastValues()->where('day', 'sunday')->first();
$value->am_amount = $state;
$value->save();
})