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
awcodes
awcodes6mo ago
You probably need to update filament.
Mstrihi
MstrihiOP6mo ago
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" },
awcodes
awcodes6mo ago
What does ‘php artisan about’ show for the installed filament version.?
Mstrihi
MstrihiOP6mo ago
this what I see in terminal
No description
awcodes
awcodes6mo ago
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
Mstrihi
MstrihiOP6mo ago
after update now I get this issue
No description
No description
Mstrihi
MstrihiOP6mo ago
and this how I use it Section::make('Rate limiting') ->id('rateLimitingSection') ->headerActions([ Action::make('edit') ->action(function () { // ... }), ]) ->schema([ // ... ])
awcodes
awcodes6mo ago
Run ‘php artisan filament:upgrade’
Mstrihi
MstrihiOP6mo ago
after run 'php artisan filament:upgrade' still same
awcodes
awcodes6mo ago
Try clearing your view cache. And have you published any filament views?
Mstrihi
MstrihiOP6mo ago
no I don't published anything, now I cleared cache, config, view but the issue still same even I don't use headerActions
Mstrihi
MstrihiOP6mo ago
this page work not problem but when you enter to record page get this issue
No description
No description
awcodes
awcodes6mo ago
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.
Mstrihi
MstrihiOP6mo ago
what I see the issue coming from resources\views\vendor\filament\components\section\index.blade .php there is any change was in the section?
awcodes
awcodes6mo ago
Or use the share link at the top right and paste that here. Someone can help further with that.
Mstrihi
MstrihiOP6mo ago
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
awcodes
awcodes6mo ago
Infolist should only affect the view page. Are you using a custom page?
Mstrihi
MstrihiOP6mo ago
no this resource page but what I understood from the issue there is 1 parameter should added to section
awcodes
awcodes6mo ago
Make sure you are importing the right Section components too.
Mstrihi
MstrihiOP6mo ago
use Filament\Infolists\Components\Section; this what I use
awcodes
awcodes6mo ago
The form section is diffent than the infolist section.
Mstrihi
MstrihiOP6mo ago
classname now is requierd on section component?
awcodes
awcodes6mo ago
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.
Mstrihi
MstrihiOP6mo ago
Mstrihi
MstrihiOP6mo ago
this live share link
awcodes
awcodes6mo ago
Probably you have data returning an array but you’re trying to use a text entry which doesn’t support arrays
Mstrihi
MstrihiOP6mo ago
I tried even I use empty section the same issue, if I remove all section the page works
awcodes
awcodes6mo ago
Can you put the resource in a gist. I’m on my phone so can’t connect to live share.
Mstrihi
MstrihiOP6mo ago
sure
Mstrihi
MstrihiOP6mo ago
Gist
MyProjectsResource.php
GitHub Gist: instantly share code, notes, and snippets.
awcodes
awcodes6mo ago
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.
Mstrihi
MstrihiOP6mo ago
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),
]); }
awcodes
awcodes6mo ago
Unless there’s something weird in your ViewRecord class, but I doubt it.
Mstrihi
MstrihiOP6mo ago
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
awcodes
awcodes6mo ago
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.
Mstrihi
MstrihiOP6mo ago
I try to rollback but not working still on 3.2.93
awcodes
awcodes6mo ago
Did it work on 3.2.92? Also please share the flare error url. So I can go through the stack trace.
Mstrihi
MstrihiOP6mo ago
I still try to rollback
awcodes
awcodes6mo ago
Set ‘filament/filament’ to ‘3.2.92’ in composer.json then run composer update.
Mstrihi
MstrihiOP6mo ago
this what I did
awcodes
awcodes6mo ago
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.
Mstrihi
MstrihiOP6mo ago
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
awcodes
awcodes6mo ago
Please send the flare share url.
Mstrihi
MstrihiOP6mo ago
Flare
trim(): Argument #1 ($string) must be of type string, array given - The error occurred at http://localhost:8000/partners/my-projects/6
awcodes
awcodes6mo ago
Hmm. Something in your code is affecting the attribute bag. Or it’s a cached view or published view.
Mstrihi
MstrihiOP6mo ago
but I already removed the cache
Mstrihi
MstrihiOP6mo ago
this resource page not view
No description
awcodes
awcodes6mo ago
What do you have in resources/views/vendor? When I say view I’m talking about the actual blade views
Mstrihi
MstrihiOP6mo ago
No description
Mstrihi
MstrihiOP6mo ago
should I remove all filament folder?
awcodes
awcodes6mo ago
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.
Mstrihi
MstrihiOP6mo ago
so can I remove them then?
awcodes
awcodes6mo ago
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.
Mstrihi
MstrihiOP6mo ago
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
awcodes
awcodes6mo ago
You too.
Want results from more Discord servers?
Add your server