After update using Section Component gives TypeError
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Section::make()
->schema([
Forms\Components\TextInput::make('year')
->required()
->numeric(),
Forms\Components\TextInput::make('rate_first_tier')
->required()
->numeric(),
Forms\Components\TextInput::make('rate_second_tier')
->required()
->numeric(),
Forms\Components\TextInput::make('rate_third_tier')
->required()
->numeric(),
Forms\Components\TextInput::make('ex_tax')
->required()
->numeric(),
])
->columns(2)
]);
}
Images are before and after.
14 Replies
Check is there any trim() helper used in your code @ZetniKovjek
Thanks for ur reply. I havent added one of those as far as i can tell
Any other suggestions?
Can you share the flare link please.?
Flare link?
If i reve this part:
Forms\Components\Section::make()
])
->columns(2)
It works
Remove*
Clicking the "Share" in the top-right of your Error page will give you a link to share the error page via Flare. It helps with debugging because the stack-trace is explorable to find out where the error is getting triggered.
Aah my bad. I'll do that tomorrow
Thanks in advance
This is the flare URL:
https://flareapp.io/share/v5pxlZA5
Flare
trim(): Argument #1 ($string) must be of type string, array given - The error occurred at https://yesenergie.local.batao.nl/admin/users/create
I think you have to provide a name for the section
without it it's breaking the state path
i think
other than that your code looks ok
Yeah i tried removing the 'name' part but no luck sadly
Double check your data and model too. Make sure none of the fields are getting cast as an array.
I actually tried it on one of my simplest model.
<?php
declare(strict_types=1);
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class TaxRebate extends Model
{
use HasFactory;
protected $fillable = [
'year',
'rate_first_tier',
'rate_second_tier',
'rate_third_tier',
'ex_tax',
];
}
The resource
And this is the page/create:
<?php
declare(strict_types=1);
namespace App\Filament\Resources\TaxRebateResource\Pages;
use App\Filament\Resources\TaxRebateResource;
use Filament\Resources\Pages\CreateRecord;
class CreateTaxRebate extends CreateRecord
{
protected static string $resource = TaxRebateResource::class;
}
So quite basic
Is this still an issue?
If yes, which specific Filament version triggers it? (You said it started "after update" ... but didn't say what version you upgraded From and To)
Also, does removing
declare(strict_types=1);
as a temporary investigative step, make any difference?