$component must not be accessed before initialization. Trying to use a modal with table edit button

Trying to use a modal from the table row button. Form loads fine as long as I don't try and access the livewire component ->modalFooterActions([ FormAction::make('Save') ->action('save') ->disabled(function ($record) { // this is causing the issue. return $this->test_complete; }), Not sure why or how to get around this?
2 Replies
dissto
dissto20h ago
What happens when you use a closure to return that array? ->modalFooterActions(fn () => [....]) 🤔
toeknee
toeknee7h ago
I don't think you can use the test_complete $this on the disabled, I assume you are wanting the parent record
->modalFooterActions([
Action::make('save')
->disabled(fn ($record) => $record->test_complete)
->button()
->close(),
])
->modalFooterActions([
Action::make('save')
->disabled(fn ($record) => $record->test_complete)
->button()
->close(),
])

Did you find this page helpful?