Hi, please help with this. why I get this error ?
Method Filament\Infolists\Components\Section::headerActions does not exist.
used same example from https://filamentphp.com/docs/3.x/infolists/layout/section
55 Replies
You probably need to update filament.
Hi @awcodes thanks for your replay. but I already did but still not working this my composer file
"require": {
"php": "^8.1",
"althinect/filament-spatie-roles-permissions": "^2.2",
"barryvdh/laravel-dompdf": "^2.0",
"eightynine/filament-excel-import": "^3.0",
"filament/filament": "^3.0-stable",
"filament/notifications": "^3.0-stable",
"flowframe/laravel-trend": "^0.1.5",
"guzzlehttp/guzzle": "^7.2",
"intervention/image": "^3.2",
"laravel/framework": "^10.10",
"laravel/sanctum": "^3.3",
"laravel/tinker": "^2.8",
"livewire/livewire": "3.0@beta",
"pxlrbt/filament-excel": "^2.1",
"spatie/laravel-permission": "^6.0"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel/pint": "^1.0",
"laravel/sail": "^1.18",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^7.0",
"phpunit/phpunit": "^10.1",
"spatie/laravel-ignition": "^2.0"
},
What does ‘php artisan about’ show for the installed filament version.?
this what I see in terminal
Yep. You need to update, latest is 3.2.93
So basically you’re trying to use 3.2 features that don’t exist in 3.0
after update now I get this issue
and this how I use it
Section::make('Rate limiting')
->id('rateLimitingSection')
->headerActions([
Action::make('edit')
->action(function () {
// ...
}),
])
->schema([
// ...
])
Run ‘php artisan filament:upgrade’
after run 'php artisan filament:upgrade' still same
Try clearing your view cache. And have you published any filament views?
no I don't published anything, now I cleared cache, config, view but the issue still same
even I don't use headerActions
this page work not problem but when you enter to record page get this issue
Ok so something in your code needs to be adjusted. Follow the stack trace to figure out why it’s getting an array instead of a string.
what I see the issue coming from resources\views\vendor\filament\components\section\index.blade
.php there is any change was in the section?
Or use the share link at the top right and paste that here. Someone can help further with that.
public static function infolist(Infolist $infolist): Infolist
{
$materialUnit = 'material.unit'; // Replace with the correct key for the unit in your state
return $infolist
->schema([
Section::make('Project Details')
->schema([
TextEntry::make('name')->label(('lang.project_name')),
TextEntry::make('project_number')->label(('lang.project_number')),
TextEntry::make('offer_number')->label(('lang.offer_number')),
TextEntry::make('order_number')->label(('lang.order_number')),
TextEntry::make('status')->label(('lang.status')),
TextEntry::make('object')->label(('lang.object')),
TextEntry::make('customer.name')->label(('lang.customer_name')),
TextEntry::make('contact.name')->label(('lang.contact_person')),
TextEntry::make('employee.name')->label(('lang.employee')),
TextEntry::make('notes')->label(('lang.notes')),
])->columns(2),
]);
}
if I remove the infolist that works
Infolist should only affect the view page. Are you using a custom page?
no this resource page but what I understood from the issue there is 1 parameter should added to section
Make sure you are importing the right Section components too.
use Filament\Infolists\Components\Section;
this what I use
The form section is diffent than the infolist section.
classname now is requierd on section component?
No, was just saying based on what I am seeing. Kinda guessing here since you’re only sharing parts of the code instead of the whole resource.
Try removing your entries one by one to see if one of them is returning invalid data.
Visual Studio Code for the Web
Build with Visual Studio Code, anywhere, anytime, entirely in your browser.
this live share link
Probably you have data returning an array but you’re trying to use a text entry which doesn’t support arrays
I tried even I use empty section the same issue, if I remove all section the page works
Can you put the resource in a gist. I’m on my phone so can’t connect to live share.
sure
First thing that stands out is that you’re not importing Action. But I would expect that to throw a different error. So it’s probably not reaching that section. Only thing I can think is like I said that one of the entries is getting an array of data when it’s expecting a string.
Comment out each section one at a time to troubleshoot. Then from there you can troubleshoot further by commenting out entries.
Other than that, nothing is standing out to me as being wrong.
I removed including action but even now if I use this not working
public static function infolist(Infolist $infolist): Infolist
{
$materialUnit = 'material.unit'; // Replace with the correct key for the unit in your state
return $infolist
->schema([
Section::make('Project Details')
->schema([
TextEntry::make('name')->label(__('lang.project_name')),
])->columns(2),
]); }
])->columns(2),
]); }
Unless there’s something weird in your ViewRecord class, but I doubt it.
if I remove all sections then works
I see exactly where is the issue
{{
$attributes->class([
'fi-section',
match ($aside) {
true => 'fi-aside grid grid-cols-1 items-start gap-x-6 gap-y-4 md:grid-cols-3',
false => 'rounded-xl bg-white shadow-sm ring-1 ring-gray-950/5 dark:bg-gray-900 dark:ring-white/10',
},
])
}}
in this file resources\views\vendor\filament\components\section\index.blade.php
so the problem I guess in last update
Can you rollback to 3.2.92? To make sure it’s not a bug. But that view code is perfectly fine.
So if it’s a bug it has to be in the php class.
Not seeing anything in the .93 release notes that would have affected sections.
And there’s been no issues reported since that release.
I try to rollback but not working still on 3.2.93
Did it work on 3.2.92?
Also please share the flare error url. So I can go through the stack trace.
I still try to rollback
Set ‘filament/filament’ to ‘3.2.92’ in composer.json then run composer update.
this what I did
Don’t use a ‘^’
So after doing the php artisan about is still showing as 93?
”filament/filament”: “3.2.92”
will lock it to that version for the update command.3.2.92 still same issue trim(): Argument #1 ($string) must be of type string, array given
if I remove this {{
$attributes->class([
'fi-section',
match ($aside) {
true => 'fi-aside grid grid-cols-1 items-start gap-x-6 gap-y-4 md:grid-cols-3',
false => 'rounded-xl bg-white shadow-sm ring-1 ring-gray-950/5 dark:bg-gray-900 dark:ring-white/10',
},
])
}}
works
Please send the flare share url.
Flare
trim(): Argument #1 ($string) must be of type string, array given - The error occurred at http://localhost:8000/partners/my-projects/6
Hmm. Something in your code is affecting the attribute bag.
Or it’s a cached view or published view.
but I already removed the cache
this resource page not view
What do you have in resources/views/vendor?
When I say view I’m talking about the actual blade views
should I remove all filament folder?
Well, there you go. You published the filament views. You should never do that unless you have an explicit reason to override them. And if you do you take responsibility for keeping them up to date with package updates.
so can I remove them then?
Unless you changed any of them, yes. Delete that whole filament folder.
If you changed any of them then you’ll need to manually update them to match.
thank you so much for your help, after I removed vendor in resource / view that works now
thank you again and have a good night
You too.