bakriawad
bakriawad
FFilament
Created by bakriawad on 2/6/2024 in #❓┊help
File upload not returning url after upload
No description
29 replies
FFilament
Created by bakriawad on 1/17/2024 in #❓┊help
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?
2 replies
FFilament
Created by bakriawad on 1/6/2024 in #❓┊help
some Tailwind classes not working
No description
31 replies
FFilament
Created by bakriawad on 1/4/2024 in #❓┊help
Action modal in livewire component not working
I am having an issue displaying a modal in a livewire component using a Filament Action I have followed the docs from: https://filamentphp.com/docs/3.x/actions/adding-an-action-to-a-livewire-component This is how it looks like:
class MyTab extends Component implements HasForms, HasActions
{
use InteractsWithActions;
use InteractsWithForms;


public function addReadingAction(): Action
{
return Action::make('Modal')
->form([ $this->getReadingsForm() ])
->action( function ($data) {
dd($data);
});
}

//...

}
class MyTab extends Component implements HasForms, HasActions
{
use InteractsWithActions;
use InteractsWithForms;


public function addReadingAction(): Action
{
return Action::make('Modal')
->form([ $this->getReadingsForm() ])
->action( function ($data) {
dd($data);
});
}

//...

}
The component:
<div class="flex justify-between align-middle my-8">
<h2 class="text-2xl font-bold">Readings</h2>
{{ $this->addReadingAction }}
</div>

<x-filament-actions::modals />
<div class="flex justify-between align-middle my-8">
<h2 class="text-2xl font-bold">Readings</h2>
{{ $this->addReadingAction }}
</div>

<x-filament-actions::modals />
The button shows, on click it loads, but no modal appears When I apply this same action in a Filament page it works and shows correctly, I am unsure to why this is...
14 replies
FFilament
Created by bakriawad on 12/29/2023 in #❓┊help
Custom import job
Getting a serializable error when trying to import using a custom job: Cannot initialize readonly property Filament\Actions\Imports\Jobs\ImportCsv::$importer from scope App\Jobs\ImportPatients (attached error message) I am tryin to import patients, patients is a model that needs Users model to exists, where patient belongs to user I have managed to create an import action, but that does not create the user with the patient, so I am resorting to creating an importer with a custom job $table->headerActions([ ImportAction::make() ->importer(PatientImporter::class) ->job(ImportPatients::class) ]) I can't figure out what's wrong, and there is no duocumentation on this.
24 replies