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
    protected static string $view = 'filament.resources.campaigns.pages.edit-campaign';

    protected function getHeaderActions(): array
    {
        return [
            Actions\ViewAction::make(),
            Actions\DeleteAction::make(),
        ];
    }

filament.resources.campaigns.pages.edit-campaign blade view where i call my livewire component
<x-filament-panels::page>
    <x-filament-panels::form wire:submit="save">
        {{ $this->form }}

        <x-filament-panels::form.actions :actions="$this->getCachedFormActions()" :full-width="$this->hasFullWidthFormActions()" />
    </x-filament-panels::form>

    @if (count($relationManagers = $this->getRelationManagers()))
        <x-filament-panels::resources.relation-managers :active-manager="$activeRelationManager" :managers="$relationManagers" :owner-record="$record"
            :page-class="static::class" />
    @endif
    <x-filament::section>
        <x-slot name="heading">
            Upload de mailing

        </x-slot>
        @livewire('upload-mailing')
    </x-filament::section>
</x-filament-panels::page>


Livewire Component Class
public Campaign $campaign;

    public function mount(Campaign $campaign)
    {
        $this->form->fill($campaign->toArray());
    }

    public function form(Form $form)
    {
        return $form
            ->schema([
                ...
            ->statePath('data')
            ->model($this->campaign);


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
Was this page helpful?