File Upload within a custom page is null

So My page resource
    <x-filament-panels::form wire:submit="submit">
        {{ $this->form }}
        <div>
            <x-filament::button type="submit" size="sm" wire:loading.attr="disabled" wire:target="submit"
                wire:loading.class="opacity-50 cursor-not-allowed">
                Verify
            </x-filament::button>
        </div>
    </x-filament-panels::form>

And my form im using the spatie media library file upload component
    /**
     * Form Schema
     *
     * @param Form $form
     * @return Form
     */
    public function form(Form $form): Form
    {
        return $form->schema([
            TextInput::make('name'),
            SpatieMediaLibraryFileUpload::make('media')
        ])
            ->statePath('data');
    }

    public function submit()
    {
        $data = $this->form->getState();
        dd($data);
    }


But in my dd() I only see name, there is nothing regarding the file upload part. Is there something im missing that I cant see in the documentation?
Solution
So something like this
    public function submit()
    {
        $model = MyModel::create($this->form->getState());
        $this->form->model($model)->saveRelationships();
    }
Was this page helpful?