F
Filament6mo ago
core

Issue after update to 3.1

i did a composer update and I am getting this error on the createpage of all the resources:
trim(): Argument #1 ($string) must be of type string, array given
trim(): Argument #1 ($string) must be of type string, array given
Solution:
That's probably the issue. Try removing it and see whether it fixes your issue
Jump to solution
44 Replies
core
core5mo ago
anyone deal with such a problem?
Dennis Koch
Dennis Koch5mo ago
At least provide a stack trace or some code. This is impossible to debug with the information given.
core
core5mo ago
here is the error stack trace :https://gist.github.com/devcbash/7d79ede9487b81e3769cc474c2cdd54a
resources / views / vendor / filament / components / section / index.blade.php : 62
include
resources / views / vendor / filament / components / section / index.blade.php : 62
include
Laravel 10.40.0.

Controller

App\Filament\Resources\RecipeResource\Pages\EditRecipe@__invoke

Route name

filament.admin.resources.recipes.edit

Middleware

panel:admin

Controller

App\Filament\Resources\RecipeResource\Pages\EditRecipe@__invoke

Route name

filament.admin.resources.recipes.edit

Middleware

panel:admin
I just upgraded via composer install
Gist
trim(): Argument #1 ($string) must be of type string, array given
trim(): Argument #1 ($string) must be of type string, array given - gist:7d79ede9487b81e3769cc474c2cdd54a
Dennis Koch
Dennis Koch5mo ago
Can you share your code and share the Flare exception page instead of that text stack trace
core
core5mo ago
it happens on resource pages /create, /edit, I can see the resources page table. only if i want to create new or edit. https://flareapp.io/share/Vme9gZAm on all resource pages. code:https://gist.github.com/devcbash/e2c9802cefa1911a64d75e51151d34d8
Dennis Koch
Dennis Koch5mo ago
Hm, hard to tell. Try removing stuff until it works and see what is causing the issue.
core
core5mo ago
thanks, i do not see how flare helps me here. I can't pinpoint the issue
Dennis Koch
Dennis Koch5mo ago
The issue is coming from the attributes on a class. But it's hard to tell which one. That's why I suggest to remove stuff
core
core5mo ago
maybe my update process is wrong? I changed the filament version in the composer.json to 3.1 and did composer install should I open an issue about it?
Dennis Koch
Dennis Koch5mo ago
Before opening an issue, try to break it down, or reproduce it in a new install
core
core5mo ago
can you suggest what to focus on?
Dennis Koch
Dennis Koch5mo ago
Not really
bionary
bionary5mo ago
I just updated to 3.2 and now I get this same error. It appears to be related to Table Filters @Dennis Koch @core All resources with filters are broken. When I comment out:
->filters([
/// Tables\Filters\Filter::make('is_approved'),
->filters([
/// Tables\Filters\Filter::make('is_approved'),
Then things go back to working normally FYI I'm using Filament 3.2 and upgraded from v2 about a month ago. When I upgraded to 3.2 today, this is when the problem with broken resources began. UPDATE: @core @Dennis Koch I just ran php artisan optimize:clear and all went back to normal. Okay, that was easy
Dennis Koch
Dennis Koch5mo ago
So you don't have artisan filament:upgrade in your composer post install scripts?
bionary
bionary5mo ago
Apparently not!
I added it so it looks like this now:
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi",
"@php artisan filament:upgrade"
],
...
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi",
"@php artisan filament:upgrade"
],
...
Should it stay like that for now on?... even though I am fully upgraded?
Log1x
Log1x5mo ago
yeah it should stay like that
bionary
bionary5mo ago
Does that mean, every time I run composer dump-autoload or dump-autoload gets triggered via script, php artisan filament:upgrade is run after the dump-autoload is complete? (trying to learn this stuff) -thanks
Log1x
Log1x5mo ago
yeah artisan filament:install should've otherwise added it to scripts for you when you initially installed filament
bionary
bionary5mo ago
If I remember correctly round 1 with the upgrade didn't go so smoothly so I did more of a manual upgrade. That was half of a Saturday upgrading from v2 to v3. I suck at this stuff. but loving v3
Log1x
Log1x5mo ago
ahh yeah not sure if it gets added when upgrading from v2 – but yeah otherwise it should be good now 😄
bionary
bionary5mo ago
Thanks buddy.
core
core5mo ago
So at the end you just ran the php artisan command?
Dennis Koch
Dennis Koch5mo ago
At the end he cleared the cache via php artisan filament:upgrade Which should be the default if you follow the docs.
core
core5mo ago
I thought this command was just for upgrading whole versions like from 2 to 3. Im trying to understand the order of things to upgrade correctly. this is not clear from the docs. From 3 to 3.1 /3.2
Log1x
Log1x5mo ago
i dont think the filament upgrade package for v2 to v3 mentioned in the docs does it automatically, but otherwise, filament:upgrade should be in post-autoload-dump as it has changes often and needs to publish its assets in most cases. you can see in the filament:install command that it gets added here: https://github.com/filamentphp/filament/blob/49be4992a5c5df58d9702de5817a6a7fbf8e1aef/packages/support/src/Commands/InstallCommand.php#L156-L163 which is reflected in my starter: https://github.com/Log1x/filament-starter/blob/main/composer.json#L50
GitHub
filament-starter/composer.json at main · Log1x/filament-starter
A beautiful starting point for your next TALL stack project using Filament. ⚡ - Log1x/filament-starter
core
core5mo ago
I found the issue it is when using the Section Component in the Form Builder if I comment it out it works fine
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Group::make()
->schema([
// Forms\Components\Section::make('Chef Info')
// ->schema([
Forms\Components\TextInput::make('name')
->required()
->maxLength(255),

Forms\Components\Textarea::make('description')
->required()
->maxLength(65535)
->columnSpanFull(),
Forms\Components\FileUpload::make('image')
->disk('s3')
->preserveFilenames(),

// ])
// ->columns(2),

])
->columnSpan(['lg' => 2]),

])
->columns(3);

}
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Group::make()
->schema([
// Forms\Components\Section::make('Chef Info')
// ->schema([
Forms\Components\TextInput::make('name')
->required()
->maxLength(255),

Forms\Components\Textarea::make('description')
->required()
->maxLength(65535)
->columnSpanFull(),
Forms\Components\FileUpload::make('image')
->disk('s3')
->preserveFilenames(),

// ])
// ->columns(2),

])
->columnSpan(['lg' => 2]),

])
->columns(3);

}
Dennis Koch
Dennis Koch5mo ago
Hm weird. Look good to me.
core
core5mo ago
yep
Dennis Koch
Dennis Koch5mo ago
Did you publish any view files?
core
core5mo ago
for this resource no
Dennis Koch
Dennis Koch5mo ago
In general. Did you publish Filament's vendor files?
core
core5mo ago
yes, I'm using shield
Dennis Koch
Dennis Koch5mo ago
That's unrelated. Are there files in resources/views/vendor/filament?
core
core5mo ago
yes the components folder
Solution
Dennis Koch
Dennis Koch5mo ago
That's probably the issue. Try removing it and see whether it fixes your issue
core
core5mo ago
thanks !great fixed that, I don't remember why I published that
Dennis Koch
Dennis Koch5mo ago
Please never do unless you really have to. Because they will get outdates and break
core
core5mo ago
just to be clear to update 3.1 to 3.2 you run composer update each time there is a stable release?
Dennis Koch
Dennis Koch5mo ago
Sorry, I don't understand?
core
core5mo ago
to upgrade filament from 3.1 to 3.2
Dennis Koch
Dennis Koch5mo ago
Normal composer update is enough to update minor versions
core
core5mo ago
great, many thanks
core
core5mo ago
have a good one
Want results from more Discord servers?
Add your server
More Posts