Filament Action in livewire component failing in a weird circumstance

I have created a custom livewire component, the component is sitting in a Filament page the component has an action
use InteractsWithActions;
use InteractsWithForms;

public $passport;

public function editPassportAction(): Action
{
return Action::make('editPassport')
->form([$this->getPassportForm()])
->action(function ($data) {
dd($data);
$res = Passport::upsert($this->passport);
dd($res);
});
}

public function mount() {}
use InteractsWithActions;
use InteractsWithForms;

public $passport;

public function editPassportAction(): Action
{
return Action::make('editPassport')
->form([$this->getPassportForm()])
->action(function ($data) {
dd($data);
$res = Passport::upsert($this->passport);
dd($res);
});
}

public function mount() {}
the mount is empty, I call the action in the component
<x-filament-actions::modals />
{{ $this->editPassport }}
<x-filament-actions::modals />
{{ $this->editPassport }}
When I click the button, the form appears, all good here. The issue is when I call for the data back from the database and set it in a variable in the component, then the framework tries to call the database to retrieve a model using it's ID, but that throws an error because the table doesn't have the ID column, it shouldn't be trying to do that at all to begin with. I tried changing the naming, but nothing, still tries. tried to call it in a separate function, still does that. In short, if I add this:
private function mount()
{
$this->passport = ArrayTable::where('holder_id',$this->holder->id)->get();
}
private function mount()
{
$this->passport = ArrayTable::where('holder_id',$this->holder->id)->get();
}
then this happens: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'ArrayTable.id' in 'where clause' Why is trying to retrieve data on a custom action??? how to stop this?
1 Reply
bakriawad
bakriawad5mo ago
I still can't figure this out. The action just calls the database, can't find the right function to override to stop this, no options I found to disable this. I can't use this action at all right now, and it's frustrating. No documentation or mentions of this at all