All relationship does not work after update to v3

For sure it is a stupid missing stuff but after migration from v2 to v3 all my relationship does not work with this message: Call to a member function x() on null
6 Replies
Dennis Koch
Dennis Koch13mo ago
Nobody can help if you don’t provide any info about your project.
Carmine Spagnuolo
Carmine SpagnuoloOP13mo ago
It is a normal project I just update to v3 and now any kind of form' fields with relationship give the Call to a member function x() on null for instance:
Forms\Components\Repeater::make('items_chiesa')
->grid(3)
->itemLabel(fn (array $state): ?string => $state['music_role_id'] ?? null)
->relationship()
...
Forms\Components\Repeater::make('items_chiesa')
->grid(3)
->itemLabel(fn (array $state): ?string => $state['music_role_id'] ?? null)
->relationship()
...
the function items_chiesa is defined in the model of the resource as normal.. when I open edit page
Call to a member function items_chiesa() on null
Call to a member function items_chiesa() on null
` @Dennis Koch what kind of information do you need (I suppose that I missed some stuff in upgrading or I don't know)
Dennis Koch
Dennis Koch13mo ago
The error means that it probably cannot find your model. Is this the panel builder? Anything special with your model keys or your resources?
Carmine Spagnuolo
Carmine SpagnuoloOP13mo ago
no is just a normal Resource mmm I use Uuid for ID
Schema::create('events', function (Blueprint $table) {
$table->uuid('id')->primary();
...
Schema::create('events', function (Blueprint $table) {
$table->uuid('id')->primary();
...
` the problem is that the $record value is null when the resourse is loaded I solved by putting all in the form of the resourse before the edit form was defined into the editpage but now one of my Repeater if I add and remove element it starts to add other items automatically
Dennis Koch
Dennis Koch13mo ago
I don’t understand what you did
Carmine Spagnuolo
Carmine SpagnuoloOP13mo ago
I use to define the form function into the editpage and not into the resource, i moved to resource the form method e removed from edit Anyway now I have a repeater field with a toggle field and it will cause graphical issue
Want results from more Discord servers?
Add your server