Skip to content

Commit

Permalink
Add new Rector rule
Browse files Browse the repository at this point in the history
  • Loading branch information
GeniJaho committed Jan 14, 2025
1 parent e9ca689 commit 874510e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/Filament/Resources/PhotoResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ public static function table(Table $table): Table
->sortable(),
ImageColumn::make('full_path')
->label('Photo')
->searchable(query: fn (Builder $query, string $search): Builder => $query->where('path', 'like', "%{$search}%")),
->searchable(query: fn (Builder $query, string $search): Builder => $query->whereLike('path', "%{$search}%")),
TextColumn::make('gps')
->label('GPS')
->getStateUsing(fn (Photo $photo): ?string => $photo->latitude && $photo->longitude
? "{$photo->latitude}, {$photo->longitude}"
: null
)
->searchable(query: fn (Builder $query, string $search): Builder => $query
->where('latitude', 'like', "%{$search}%")
->orWhere('longitude', 'like', "%{$search}%")
->whereLike('latitude', "%{$search}%")
->orWhereLike('longitude', "%{$search}%")
),
TextColumn::make('original_file_name')
->sortable()
Expand Down
2 changes: 2 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Rector\Config\RectorConfig;
use RectorLaravel\Rector\ClassMethod\AddGenericReturnTypeToRelationsRector;
use RectorLaravel\Rector\ClassMethod\MigrateToSimplifiedAttributeRector;
use RectorLaravel\Rector\MethodCall\WhereToWhereLikeRector;
use RectorLaravel\Rector\PropertyFetch\ReplaceFakerInstanceWithHelperRector;
use RectorLaravel\Set\LaravelLevelSetList;
use RectorLaravel\Set\LaravelSetList;
Expand Down Expand Up @@ -39,6 +40,7 @@
->withRules([
MigrateToSimplifiedAttributeRector::class,
AddGenericReturnTypeToRelationsRector::class,
WhereToWhereLikeRector::class,
])
->withSkip([
EncapsedStringsToSprintfRector::class,
Expand Down

0 comments on commit 874510e

Please sign in to comment.