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:Jump to 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')
4 Replies
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);
}),
nice to know
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')
Thank you, it's work for me