3

I have an existing Laravel/Nova project and tables. I am introducing a new set of tables into the mix.

Old Structure:
Field -> FieldValue

New Structure:
ComplexField -> ComplexFieldValue
Field -> FieldValue -> ComplexFieldValue

If I try to use the edit icon from the FieldValue with (HasMany), I get a blank screen and a notice of a 404 error in my network window.

If I view the record then edit it. It works fine.

If I edit from the ComplexField, it will successfully bring up the screen to edit the record.

The browser headers show for the working method:

Request URL: http://localhost/nova-api/complex-fields/field/complexFieldValues
Request Method: GET
Status Code: 200 OK
...
X-Powered-By: PHP/7.1.19
Accept: application/json, text/plain, /
Host: localhost
Referer: http://localhost/nova/resources/complex-field-values/42/edit?viaResource=complex-fields&viaResourceId=3&viaRelationship=complexFieldValues

Where as the non working method shows:

Request URL: http://localhost/nova-api/field-values/field/complexFieldValues
Request Method: GET
Status Code: 404 Not Found
...
X-Powered-By: PHP/7.1.19
Accept: application/json, text/plain, /
Host: localhost
Referer: http://localhost/nova/resources/complex-field-values/42/edit?viaResource=field-values&viaResourceId=291&viaRelationship=complexFieldValues

Any ideas on what would be causing this behavior?

I thought maybe the field-values may be causing routing issues. I changed them over to simple-field-values without success.

Both Resources are using:

HasMany::make('Complex Field Values', 'complexFieldValues'),

Both Models are using a trait that uses the models foreign key.

    public function complexFieldValues()
    {
        return $this->HasMany('App\Models\ComplexFieldValue', $this->foreignKey, 'id', \App\Nova\ComplexFieldValue::class);
    }

0 Answers0