filamentphp / 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.
https://filamentphp.com
MIT License
18.1k stars 2.83k forks source link

Attempt to read property "budget" on null on form submit. #10541

Closed MechanicalEclipse closed 9 months ago

MechanicalEclipse commented 9 months ago

i'm having this error ' Attempt to read property "budget" on null ' when trying to submit this form.

The form shows correctly the numbers and also min and max, but wen i try to submit it throws the error.

            TextInput::make('quote')
                ->required()
                ->numeric()
                ->maxValue((int)$project->budget)
                ->minValue((int)$project->budget*0.4)
                ->prefixIcon('heroicon-s-currency-euro')
                ->prefix('Min. '.Number::currency($project->budget*0.4, 'EUR', 'fr'))
                ->suffix('Max. '.Number::currency($project->budget, 'EUR', 'fr'))
                ->label('Budget'),
            Select::make('project_id')
            ->required()
            ->relationship(
                name: 'project',
                titleAttribute: 'slug',
                modifyQueryUsing: fn (Builder $query) =>
                    $query->where('id', request()->route()->parameter('project'))
                )
                ->preload()
                ->label('Progetto'),

For example in this case min is 10000 and max is 25000 but when i submit it throws the error

Min works image

Max works image

Any clue?

Originally posted by @MechanicalEclipse in https://github.com/filamentphp/filament/discussions/10416

zepfietje commented 9 months ago

Please create an issue using the bug report template, and provide a reproduction repository.