I am using filament/spatie-laravel-media-library-plugin but having an issue showing the first image

I was able to upload multiple images in a collection() with no issues at all, but what I am trying to do is showing the first image in the collection in the list of projects table:
Tables\Columns\SpatieMediaLibraryImageColumn::make('image')
->label(__('Image'))
->collection('project-images')
->wrap(),
Tables\Columns\SpatieMediaLibraryImageColumn::make('image')
->label(__('Image'))
->collection('project-images')
->wrap(),
This code is showing the while collection which might have 4, 10, etc..., what I am looking for is to show one (first) of the collection. I was hoping to find a method like
->first()
->first()
or so. Any help please @everyone
Solution:
->limit(1)
Jump to solution
8 Replies
Solution
DrByte
DrByteβ€’6mo ago
->limit(1)
DrByte
DrByteβ€’6mo ago
The SpatieImageColumn is an extension of the ImageColumn component, so all the base features are included. See https://filamentphp.com/docs/3.x/tables/columns/image#setting-a-limit
Ihab Abu Afia
Ihab Abu Afiaβ€’6mo ago
You saved my life πŸ˜„
DrByte
DrByteβ€’6mo ago
Goal accomplished. 🀣
awcodes
awcodesβ€’6mo ago
Well he is a doctor. Life saving is in the job description. πŸ˜‚
Ihab Abu Afia
Ihab Abu Afiaβ€’6mo ago
πŸ˜‚ Well done guys.
DrByte
DrByteβ€’6mo ago
Nicely played.
Ihab Abu Afia
Ihab Abu Afiaβ€’6mo ago
Felament people are the best players πŸ˜‚
Want results from more Discord servers?
Add your server
More Posts