Skip to content

Commit

Permalink
Add edit option
Browse files Browse the repository at this point in the history
  • Loading branch information
svenvg93 committed Dec 17, 2024
1 parent 165e132 commit faa6519
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions app/Filament/Resources/ResultResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,22 @@ public static function table(Table $table): Table
->maxLength(500),
])
->modalButton('Save'),
Tables\Actions\Action::make('updateHealthy')
->icon('heroicon-o-check-circle')
->hidden(fn (): bool => ! auth()->user()->is_admin && ! auth()->user()->is_user)
->hidden(fn (Result $record): bool => $record->status !== ResultStatus::Completed)
->mountUsing(fn (Forms\ComponentContainer $form, Result $record) => $form->fill([
'healthy' => $record->healthy,
]))
->action(function (Result $record, array $data): void {
$record->healthy = $data['healthy'];
$record->save();
})
->form([
Forms\Components\Checkbox::make('healthy')
->label('Healthy'),
])
->modalButton('Save'),
Tables\Actions\DeleteAction::make(),
]),
])
Expand Down

0 comments on commit faa6519

Please sign in to comment.