Add custom functionality to create page

I want to add bar code reader support, so when user is on this create page and read a barcode, a value is selected on a certain select field. How can I achieve this? Thanks
8 Replies
awcodes
awcodes16mo ago
This could be interesting. It would have to get into web sockets probably with some normal laravel api endpoints too. I would recommend trying to get it to work in regular Laravel first then port it into filament. Filament is still just Laravel.
Francisco García
Francisco GarcíaOP16mo ago
I have it working, but can't mind how to port it to filament, may be custom field and add there the functionality? or how? I watch it like, implement javascript library to detect the reader, detect the read action, search in API, validate and set value in select field if all good. also don't know if make javascript api call or a way to call a livewire action to do that and the select field assignment.
awcodes
awcodes16mo ago
It’d just be a custom field. Then you could use $set to change the value of the other field. You would probably need livewire listeners on the page class though. If I’m thinking of your integration correctly.
Francisco García
Francisco GarcíaOP16mo ago
daccord, will check... was thinking if there was another way, maybe a way to inject javascript or something to the create page. Thanks.
awcodes
awcodes16mo ago
You can use render hooks. Or register a js asset.
Francisco García
Francisco GarcíaOP16mo ago
excellent, will check that, thanks.
awcodes
awcodes16mo ago
If you register the script in a service provider with ->loadedOnRequest() you could just call in on the component to only load it when it’s needed too. https://filamentphp.com/docs/3.x/support/assets#lazy-loading-javascript
Francisco García
Francisco GarcíaOP16mo ago
thanks
Want results from more Discord servers?
Add your server