getTabs v3.2.77 error: trim(): Argument #1 ($string) must be of type string, Filament\Support\Enums\

Something has changed between Filament v3.2.76 and v3.2.77 with getTabs. In .76, this code works fine:
<?php

namespace App\Filament\Resources\EndpointResource\Pages;

use App\Filament\Resources\EndpointResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;
use Filament\Resources\Components\Tab;
use Filament\Support\Enums\IconPosition;
use Illuminate\Database\Eloquent\Builder;
use Archilex\AdvancedTables\AdvancedTables;

class ListEndpoints extends ListRecords
{
protected static string $resource = EndpointResource::class;

use AdvancedTables;

public function getTabs(): array
{
return [
'all' => Tab::make('All')
->label('All')
->icon('heroicon-m-ellipsis-horizontal-circle')
->iconPosition(IconPosition::After),
'live' => Tab::make('Live')
->label('Live')
->icon('heroicon-o-signal')
->iconPosition(IconPosition::After)
->modifyQueryUsing(fn (Builder $query) => $query->where('status', 'Live')),
'pending' => Tab::make('Pending')
->label('Pending')
->icon('heroicon-o-bolt-slash')
->iconPosition(IconPosition::After)
->modifyQueryUsing(fn (Builder $query) => $query->where('status', 'Pending')),
'inactive' => Tab::make('Inactive')
->label('Inactive')
->icon('heroicon-m-signal-slash')
->iconPosition(IconPosition::After)
->modifyQueryUsing(fn (Builder $query) => $query->where('status', 'Inactive')),
];
}

}
<?php

namespace App\Filament\Resources\EndpointResource\Pages;

use App\Filament\Resources\EndpointResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;
use Filament\Resources\Components\Tab;
use Filament\Support\Enums\IconPosition;
use Illuminate\Database\Eloquent\Builder;
use Archilex\AdvancedTables\AdvancedTables;

class ListEndpoints extends ListRecords
{
protected static string $resource = EndpointResource::class;

use AdvancedTables;

public function getTabs(): array
{
return [
'all' => Tab::make('All')
->label('All')
->icon('heroicon-m-ellipsis-horizontal-circle')
->iconPosition(IconPosition::After),
'live' => Tab::make('Live')
->label('Live')
->icon('heroicon-o-signal')
->iconPosition(IconPosition::After)
->modifyQueryUsing(fn (Builder $query) => $query->where('status', 'Live')),
'pending' => Tab::make('Pending')
->label('Pending')
->icon('heroicon-o-bolt-slash')
->iconPosition(IconPosition::After)
->modifyQueryUsing(fn (Builder $query) => $query->where('status', 'Pending')),
'inactive' => Tab::make('Inactive')
->label('Inactive')
->icon('heroicon-m-signal-slash')
->iconPosition(IconPosition::After)
->modifyQueryUsing(fn (Builder $query) => $query->where('status', 'Inactive')),
];
}

}
That same code results in this error in 3.2.77:
TypeError
PHP 8.3.6
10.48.10
trim(): Argument #1 ($string) must be of type string, Filament\Support\Enums\IconPosition given
TypeError
PHP 8.3.6
10.48.10
trim(): Argument #1 ($string) must be of type string, Filament\Support\Enums\IconPosition given
I'm not sure what I'm doing wrong, as that appears to be valid usage according to documentation.
Solution:
Issue resolved by removing published filament-views: /resources/views/vendor/filament
Jump to solution
11 Replies
LeviBeezy
LeviBeezyOP7mo ago
I didn't mention, I tried this as well with iconPosition -- or giving no iconPosition at all. The problem persists: ->iconPosition(IconPosition::Before),
LeandroFerreira
LeandroFerreira7mo ago
->iconPosition('after') works?
LeviBeezy
LeviBeezyOP7mo ago
on 3.2.76, yes. When I update to anything after that -- including up to .80 (latest at time of this comment) it fails with this error:
No description
LeviBeezy
LeviBeezyOP7mo ago
No description
LeviBeezy
LeviBeezyOP7mo ago
Either one of these causes the trim() error above
No description
No description
LeviBeezy
LeviBeezyOP7mo ago
It looks like I'm going to have to put an "Issue" on github with a repo that showcases the error
LeandroFerreira
LeandroFerreira7mo ago
yes please
Andrew Wallo
Andrew Wallo7mo ago
What theme is this?
LeviBeezy
LeviBeezyOP7mo ago
GitHub
GitHub - BeardedBear/bearded-theme: The VS Code theme with a long b...
The VS Code theme with a long beard. Contribute to BeardedBear/bearded-theme development by creating an account on GitHub.
LeviBeezy
LeviBeezyOP7mo ago
I'm actually an idiot. The entire problem was that I published filament views and didn't listen to Dan here: https://filamentphp.com/community/danharrin-publishing-views-in-laravel -- I republished views, but ultimately I'd just like to "undo" the published views. Is it as simple as deleting the resources/views/vendor/filament directory?
Filament
Publishing Views in Laravel by Dan Harrin - Filament
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
Solution
LeviBeezy
LeviBeezy7mo ago
Issue resolved by removing published filament-views: /resources/views/vendor/filament
Want results from more Discord servers?
Add your server