F
Filament12mo ago
jaocero

How to achieve imagecolumn with textcolumn in one column?

I have found this in the filament documentation and I want to implement but I can't seems to work it out.
public function table(Table $table): Table
{
return $table
->query(CompanyLog::query()->where('company_id', $this->organization->id))
->columns([
Tables\Columns\Layout\Stack::make([
Tables\Columns\ImageColumn::make('user.user_profile_image_url')
->label('Profile Image')
->defaultImageUrl(function (CompanyLog $record) {

return get_ui_gravatar_url(
firstName: $record->user->firstname,
lastName: $record->user->lastname,
email: $record->user->email,
avatarColor: $record->user->avatar_color_properties
);
})
->circular()
->grow(false),
Tables\Columns\TextColumn::make('created_at')
->label('Date')
->dateTime('F j, Y - g:i A')
->color('gray')
->size(TextColumnSize::Small)
->searchable()
->sortable()
->wrap(),
Tables\Columns\TextColumn::make('content2')
->label('Activities')
->size(TextColumnSize::Medium)
->searchable()
->sortable()
->wrap()
->html(),
])
])
->defaultSort('created_at', 'desc')
->filters([
// ...
])
->actions([
// ...
])
->bulkActions([
// ...
]);
}
public function table(Table $table): Table
{
return $table
->query(CompanyLog::query()->where('company_id', $this->organization->id))
->columns([
Tables\Columns\Layout\Stack::make([
Tables\Columns\ImageColumn::make('user.user_profile_image_url')
->label('Profile Image')
->defaultImageUrl(function (CompanyLog $record) {

return get_ui_gravatar_url(
firstName: $record->user->firstname,
lastName: $record->user->lastname,
email: $record->user->email,
avatarColor: $record->user->avatar_color_properties
);
})
->circular()
->grow(false),
Tables\Columns\TextColumn::make('created_at')
->label('Date')
->dateTime('F j, Y - g:i A')
->color('gray')
->size(TextColumnSize::Small)
->searchable()
->sortable()
->wrap(),
Tables\Columns\TextColumn::make('content2')
->label('Activities')
->size(TextColumnSize::Medium)
->searchable()
->sortable()
->wrap()
->html(),
])
])
->defaultSort('created_at', 'desc')
->filters([
// ...
])
->actions([
// ...
])
->bulkActions([
// ...
]);
}
No description
Solution:
It works using this: ```php ->columns([ Tables\Columns\Layout\Split::make([ Tables\Columns\ImageColumn::make('user.user_profile_image_url')...
Jump to solution
1 Reply
Solution
jaocero
jaocero12mo ago
It works using this:
->columns([
Tables\Columns\Layout\Split::make([
Tables\Columns\ImageColumn::make('user.user_profile_image_url')
->label('Profile Image')
->defaultImageUrl(function (CompanyLog $record) {

return get_ui_gravatar_url(
firstName: $record->user->firstname,
lastName: $record->user->lastname,
email: $record->user->email,
avatarColor: $record->user->avatar_color_properties
);
})
->circular()
->grow(false),
Tables\Columns\Layout\Stack::make([
Tables\Columns\TextColumn::make('created_at')
->label('Date')
->dateTime('F j, Y - g:i A')
->color('gray')
->size(TextColumnSize::Small)
->searchable()
->sortable()
->wrap(),
Tables\Columns\TextColumn::make('content2')
->label('Activities')
->size(TextColumnSize::Medium)
->searchable()
->sortable()
->wrap()
->html(),
])
])
])
->columns([
Tables\Columns\Layout\Split::make([
Tables\Columns\ImageColumn::make('user.user_profile_image_url')
->label('Profile Image')
->defaultImageUrl(function (CompanyLog $record) {

return get_ui_gravatar_url(
firstName: $record->user->firstname,
lastName: $record->user->lastname,
email: $record->user->email,
avatarColor: $record->user->avatar_color_properties
);
})
->circular()
->grow(false),
Tables\Columns\Layout\Stack::make([
Tables\Columns\TextColumn::make('created_at')
->label('Date')
->dateTime('F j, Y - g:i A')
->color('gray')
->size(TextColumnSize::Small)
->searchable()
->sortable()
->wrap(),
Tables\Columns\TextColumn::make('content2')
->label('Activities')
->size(TextColumnSize::Medium)
->searchable()
->sortable()
->wrap()
->html(),
])
])
])
Want results from more Discord servers?
Add your server