rawilk / laravel-form-components

Form components built for Tailwind & Livewire.
https://randallwilk.dev/docs/laravel-form-components
MIT License
386 stars 42 forks source link

FilePond uploaded file preview and validation issue #42

Closed darkons closed 2 years ago

darkons commented 2 years ago

Hello! Congratulations for create this wonderful package.

We are using FilePond component with ImagePreview plugin but I have a few questions.

<x-tw-form-group label="Image" name="user.avatar">
    <x-tw-file-pond name="user.avatar" class="mt-1" wire:model="user.avatar" />
</x-tw-form-group>

Everything works fine, image preview (registered in app.js), etc. but the validation does not seem to work with an object model like the example above.

Another question is how to show a preview of an uploaded file when you are editing an entity. For example, when you are editing an User I want to show his current avatar in database. Ex: /images/avatars/10.jpg

I look forward to your help as it is very important for us to be able to use this component. If you need more information, please do not hesitate to ask.

Thank you!

rawilk commented 2 years ago

Thank you for your interest in this package.

Everything works fine, image preview (registered in app.js), etc. but the validation does not seem to work with an object model like the example above.

Unfortunately that is outside the scope of this package but I believe referring to the livewire docs should point you in the right direction for that.

Another question is how to show a preview of an uploaded file when you are editing an entity. For example, when you are editing an User I want to show his current avatar in database. Ex: /images/avatars/10.jpg

This is also outside the scope of this package, but I'm pretty sure this is covered in the livewire docs which will show you how to retrieve the uploaded file's temporary preview. As far as the user's current avatar, that all depends on how you are storing them in your filesystem/database.