How can i change imagecolumn if null and return url instead of url from database?
How can i change imagecolumn if null and return url instead of url from database?
16 Replies
Do you really want to store a default url when it is null? why not just render the default image if it's null?
i don't want to store just return url instead if data null
But you are using a form, so if you are returning a url you will be saving that url when it's returned?
i mean ImageColumn in listing
Ahh you listed Form Builder above
Tables Columns
Tables\Columns\ImageColumn::make('profile_pic')->label('Profile Picture'),
i need something like this
$image = true
image ? Tables\Columns\ImageColumn::make('profile_pic') : Tables\Columns\ImageColumn::make('profile_pic')->defaultImageUrl(url('/images/placeholder.png'))
using Ternary ? :
i see
do you mean
default
will handle this for us ?
if data from database nullGood example is this working:
yes it will, as if it is empty a default is applied
thank you
it's working fine
You are welcome
i just started with filament today and i learned a lot,
thank team discord fri
Awesome stuff! Life just gets easier from here out! π
filament is my life saver lol
hang on
defaultImageUrl() is a feature we added yesterday
does it not work?
nope
i got error 503
@toeknee_iom can i do dm to your ?