next record
Can someone help me
I have the following situation
my table with the following fields
protected $fillable = [
'type_id',
'responsible_id',
'jobs_id',
'sequence',
'finished',
'started',
'priority'
];
When I change the Togglecolumn button I need to find the next sequence to update to true
Tables\Columns\ToggleColumn::make(name: 'started')->label('Started')
->onColor('success')
->offColor('danger')
->disabled(fn ($record): bool => !$record->finished === false)
->disabled(fn ($record): bool => !$record->started === false),
Tables\Columns\IconColumn::make(name: 'finished')->boolean(),
Tables\Columns\ToggleColumn::make(name: 'finished')->label('Finished')
->onColor('success')
->offColor('danger')
->disabled(fn ($record): bool => !$record->finished === false)
->beforeStateUpdated(function ($record, $state) {
$test = $record->sequence + 1;
return $record->update(['started' => $state?:true]);
}),
0 Replies