Inject Model in Livewire Component
I'm trying to inject my campaign model in a livewire component through form.
I tried the instructions from https://filamentphp.com/docs/3.x/forms/adding-a-form-to-a-livewire-component#setting-a-form-model
But i'm receiving this excepetion
https://flareapp.io/share/Bm0YvpJP
EditCampaign Class
filament.resources.campaigns.pages.edit-campaign blade view where i call my livewire component
Livewire Component Class
Thanks for any help.
Flare
Typed property App\Livewire\UploadMailing::$campaign must not be accessed before initialization - The error occurred at http://localhost/admin/campaigns/1/edit
3 Replies
you don't have a property
$campaign
in your class,
1. Use property promotion
public function mount(protected Campaign $campaign)
2. Or assign manually to your class
I have the property, first line of my example.
I tried manually, but same problem.
I "fixed" passing the record as a parameter in the livewire component.
i'm sorry? the code you provided now is different from the one in the question