F
Filamentβ€’16mo ago
developer

ImageColumn() set path

How can I set the image path when using ImageColumn() if in the database I only have the image's name stored, not the complete path? ... btw this is an existing laravel project which I'm trying to migrate to filament πŸ¦’
Solution:
but notice you can also set the ->disk() I've created a new laravel disk with the path where my images lives, I'm using it like this: ImageColumn('user_avatar')->disk('avatars')
Jump to solution
4 Replies
johnpuddles
johnpuddlesβ€’16mo ago
You can customize the value shown in a column by using the state() method https://filamentphp.com/docs/3.x/tables/columns/getting-started#calculated-state e.g. Tables\Columns\ImageColumn::make("image") ->label("Image") ->state(function (Model $record) { return Storage::disk('cloud')->url($record->image); }),
developer
developerOPβ€’16mo ago
nice to know
Solution
developer
developerβ€’16mo ago
but notice you can also set the ->disk() I've created a new laravel disk with the path where my images lives, I'm using it like this: ImageColumn('user_avatar')->disk('avatars')
Sandeep
Sandeepβ€’15mo ago
Thank you, it's work for me
Want results from more Discord servers?
Add your server