achraf
video
Actions::make([
Action::make('toggleValidImages')
->label(fn ($record) => $record->deal->valid_images ? 'Set Invalid' : 'Set Valid')
->action(function (Request $record) {
// Assuming there's a 'deal' relationship on 'Request'
$deal = $record->deal;
$deal->valid_images = !$deal->valid_images;
$deal->save();
})
->icon(fn ($record) => $record->deal->valid_images ? 'heroicon-s-check' : 'heroicon-s-check')
->color('success')
])
->visible(fn ($record) => $record->deal !== null)
]),
12 replies