Why is my $record->save(); not working

Should I expect one of these to save the current record?

Action::make('Run Campaign')
     ->action(function (Campaign $record, Set $set) {
         $set('status_id', CampaignStatusEnum::Run );
         $record->save();
    }),

Or
 Action::make('Pause Campaign')
->action(function (?Model $record, Set $set) {
    $set('status_id', CampaignStatusEnum::Paused );
    $record->save();
})

The field changes on the scren but is not save.
Solution
in your case if you want to update the model you need to do

 Action::make('Pause Campaign')
->action(function (?Model $record) {
    $record->status_id = CampaignStatusEnum::Paused;
    $record->save();
})
Was this page helpful?