Can I just upload images without the Spatie MediaPro library?

It looks like I should be able to add a page (not a resource) and build a form on that page and use the official Spatie Media Plugin for FilamentPHP to upload pics . . . they are being stored in the temp table, but I can't get them to be acknowledged in my page?? public function create(): void { $this->data = $this->form->getState('data'); $this->data['employee_id'] = auth()->user()->employeeid; $this->data['school_number'] = $this->schoolid; $this->data['dcid'] = $this->dcid; $this->data['student_first_name'] = $this->student_first_name; $this->data['student_last_name'] = $this->student_last_name; $this->data['grade_level'] = $this->grade_level; $this->data['year'] = '2023-2024'; $device = CollectedDevice::updateOrCreate(['student_number' => $this->student_number,'year'=> $this->data['year']],$this->data); //$device = CollectedDevice::create($this->form->getState('data')); // This barfs because I dont' have the pro license // $device->addFromMediaLibraryRequest($this->photos)->toMediaCollection('images'); foreach($this->photos as $photo) { $device->addMedia($photo->livewire-file)->toMediaCollection('images'); } $this->form->model($device)->saveRelationships();
1 Reply
Dennis Koch
Dennis Koch7mo ago
Not sure why you 1) do all that manual mapping and 2) don't just use our spatie media library plugin: https://filamentphp.com/plugins/filament-spatie-media-library
Filament
Spatie Media Library by Filament - Filament
Filament support for Spatie's Laravel Media Library package.
Want results from more Discord servers?
Add your server