public function infolist(Infolist $infolist): Infolist { return $infolist ->record($this->user) ->schema([ Fieldset::make('Your Consent is required')->schema([ RepeatableEntry::make('collections') ->schema([ Section::make(fn (ConsentOption $record) => "{$record->title} V{$record->version}") ->description(function (ConsentOption $record) { $suffix = $this->previousConsents($record->key); $mandatory = $record->is_mandatory ? 'Mandatory' : 'Optional'; if ($suffix) { $mandatory .= " - ( $suffix )"; } return $mandatory; }) ->schema([ TextEntry::make('text')->label('') ->markdown(), Group::make()->schema([ ViewEntry::make('acceptConsent') ->label('') ->view('xxxxxx.infolists.components.consent-option-checkbox'), TextEntry::make('updated_at')->label('Last Updated'), ]), ]), ]) Actions::make([ Action::make('saveConsents') ->before(function (Action $action) { $this->validateConsents($action); }) ->action(function (array $data) { $this->acceptConsent(); }), ]), ]), } public function validateConsents($action) { $validateMandatoryConsents = $this->user->requiredOutstandingConsentsValidate($this->acceptConsents); if (! $validateMandatoryConsents) { Notification::make() ->title('Please confirm.!') ->send(); $action->cancel(); } }