Livewire - Value will not be handed over to Filament Custom Form - pls explain
Hello Guys,
we are trying to get NativePHP Camera Function working with Livewire and Filament V4 in a custom component
Environment:
Laravel: 12
Livewire: 3
Filament: 4
NativePHP: 1.13
The challange here is to get the data back to the Filament V4 Component from Livewire.
What is working so far?
The Camera event is working, and we can see the image displayed via "resources\views\livewire\camera.blade.php".
We think the problem is with our Livewire Code, and NativePHP has no impact here ...
So this means, NativePHP does it´s job so far. But we are not experienced with LiveWire - the current situation is, that the image data we expect from wire:model="{{ $getStatePath() }}" (resources\views\filament\forms\components\camera.blade.php)
is not getting handed over to PHP / Filament. What we expect is, that the $state from Camera::make('string1') would contain the base64 image data, but in our code seems something wrong. The $state of this field seems to never get updated.
Could someone please explain what´s wrong here? At the moment, we have absolutely no clue, what´s missing here.
many thanks
BR
Files: i try to upload as comment...
4 Replies
app\Filament\Resources\featuretests\Schemas\featuretestForm.php
app\Filament\Forms\Components\Camera.php
resources\views\filament\forms\components\camera.blade.php
app\Livewire\Camera.php
resources\views\livewire\camera.blade.php
Would that not be the same as this field?
https://filamentphp.com/plugins/emmanpbarrameda-take-picture-field Which will allow you to review how he handled it?
Filament
Take Picture Field by Emman Barrameda - Filament
A custom Filament form component to capture photos from your device camera.
the solution was to change Camera.php to this, and add #[Modelable] - tbh, i do not fully understand, but it´s working as expected now, here the updated file, to save someone else 2-3 days 🙂
ok seems there are more things to consider - with this variant only one upload per page is possible .... we need to figure out what causes the problm.
Change state to be and arrary and merge them?