hi I am using Spatie media library and getting the error other have got here, 'avatar_id' doesn't have a default value, I saw that I need to add the model to the form via the docs but I am a bit confused where to add this as I have a create page for the wizard. so it's not encapsulated by a form.
Where do I add it to the create page with wizard?
I am a bit confused why I have a separate create page for the wizard but still a normal resource with a form (It may be for editing reasons), I know I'm being dumb but I do not understand fully.
So you want to use Spatie's Media Library with a wizard. Here's what you can do: just inject the model into your wizard's create page and associate the media with it. For example:
You would do something like this: public function create(User $user) { $user->addMedia($request->file('avatar'))->toMediaCollection('avatar'); }