-
-
Save chrispian/a47c0812adf954daabb73f5d87bde23c to your computer and use it in GitHub Desktop.
Filament Card Table Layout
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Filament\Resources\Trip; | |
//... | |
class PlaceResource extends Resource | |
{ | |
public static function table(Table $table): Table | |
{ | |
return $table | |
->columns([ | |
Tables\Columns\Layout\Split::make([ | |
Tables\Columns\Layout\Grid::make() | |
->schema([ | |
Tables\Columns\Layout\Grid::make() | |
->schema([ | |
SpatieMediaLibraryImageColumn::make('image') | |
->collection('images') | |
->height('200px') | |
->extraAttributes([ | |
'style' => app()->getLocale() == 'ar' ? 'margin:-12px -16px 0px -40px' : 'margin:-12px -40px 0px -16px', | |
]) | |
->extraImgAttributes([ | |
'class' => 'object-cover h-fit rounded-t-xl w-full', | |
]), | |
]) | |
->columns(1), | |
Tables\Columns\Layout\Grid::make() | |
->schema([ | |
Tables\Columns\TextColumn::make('name') | |
->searchable() | |
->extraAttributes([ | |
'class' => 'text-gray-500 dark:text-gray-300 text-xs' | |
]) | |
->columnSpan(2), | |
Tables\Columns\TextColumn::make('created_at') | |
->since() | |
->sortable() | |
->extraAttributes([ | |
'class' => 'text-gray-500 dark:text-gray-300 text-xs' | |
]) | |
->alignEnd(), | |
]) | |
->extraAttributes([ | |
'class' => 'mt-2 -mr-6 rtl:-ml-6 rtl:mr-0' | |
]) | |
->columns(3), | |
Tables\Columns\Layout\Grid::make() | |
->schema([ | |
Tables\Columns\TextColumn::make('created_by') | |
->default('Admin') | |
->extraAttributes([ | |
'class' => 'text-gray-500 dark:text-gray-300 text-xs' | |
]) | |
->alignEnd(), | |
]) | |
->extraAttributes([ | |
'class' => '-mr-6 rtl:-ml-6 rtl:mr-0' | |
]) | |
->columns(1), | |
Tables\Columns\Layout\Grid::make() | |
->schema([ | |
Tables\Columns\TextColumn::make('description') | |
->extraAttributes([ | |
'class' => 'text-gray-700 dark:text-gray-300 text-xs' | |
]) | |
->alignJustify(), | |
]) | |
->columns(1) | |
->extraAttributes([ | |
'class' => 'mb-3 -mr-6 rtl:-ml-6 rtl:mr-0' | |
]), | |
]) | |
->columns(1), | |
]), | |
]) | |
->defaultSort('created_by','desc') | |
->contentGrid([ | |
'md' => 2, | |
'xl' => 4, | |
'2xl' => 5, | |
]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment