Skip to content

Commit

Permalink
add sort + filter by approx. year
Browse files Browse the repository at this point in the history
  • Loading branch information
igor-kamil committed Dec 9, 2023
1 parent 3302b14 commit 52002bd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions app/Filament/Resources/ItemResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,8 @@ public static function table(Table $table): Table
->getStateUsing(function (Item $record) {
return Str::limit($record->author, 15);
}),
Tables\Columns\TextColumn::make('year_from')
->getStateUsing(function (Item $record) {
return Str::limit($record->year_from, 15);
})
Tables\Columns\TextColumn::make('year')
->label('Year (approx.)')
->sortable(),
Tables\Columns\TextColumn::make('view_count')
->label('Views')
Expand All @@ -82,6 +80,10 @@ public static function table(Table $table): Table
->toggle()
->label('Has image')
->query(fn (Builder $query) => $query->whereNotNull('tiny_placeholder')),
Tables\Filters\Filter::make('year_not_null')
->toggle()
->label('Has approx. year')
->query(fn (Builder $query) => $query->whereNotNull('year')),
])
->actions([
// Tables\Actions\EditAction::make(),
Expand Down

0 comments on commit 52002bd

Please sign in to comment.