Pantlock
FileUpdload not displaying file preview
Firstly, yes.. I linked the storage folder to the public folder.
I have a model
Event
that has a nullable string column image
.
I want to have a default image that is displayed on the frontend when image is uploaded.
The default image is at public/img/event/default-event.png
The uploaded files from Filament should go to storage/app/public/event/xxx.png
(public/storage/event/xxx.png
)
Currently, I have defined an Accessor on the model:
That Storage::url($value)
is causing trouble for Filament, as it doesn't show the file preview when used with the FileUpload form component.
For reference, this is the component in use:
1 replies
Reorderable with descending order
Hi, I have an app with a resource that I want to be reorderable, but with a descending order. I am using the
spatie/eloquent-sortable
package fot the order_column
.
In the filament resource file, I have the ->defaultSort('order_column', 'desc')
that changes the order when just viewing all the records. Then of course I have the ->reorderable('order_column')
on the table as well.
Has anyone dealt with the fact that the reorderable uses ascending order? I would like the order to stay the same when viewing and editing the records.
Is there some simple workaround?4 replies
Data type for FileUpload
I have simple Page, generated with
php artisan make:filament-page
In there I have a Form with multiple components, one of them being FileUpload (for uploading image).
The property I want to use to store the image name is $quote_1_image. In databases this column is a string.
I'm however getting this error:
Cannot assign array to property App\Filament\Pages\HomePage::$quote_1_image of type ?string
When I change the datatype to array, the error says:
Cannot assign string to property App\Filament\Pages\HomePage::$quote_1_image of type ?array
2 replies