nova-belongsto-depend
nova-belongsto-depend copied to clipboard
depend On Relationship not found
Laravel version 5.8 Nova version 2.0
I have Country and City models, and trying to link them together.
NovaBelongsToDepend::make('Country')
->options(\App\MyProject\Countries\Country::all()),
NovaBelongsToDepend::make('City')
->optionsResolve(function ($country) {
return $country->cities()->get(['id','name']);
})
->dependsOn('Country'),
I'm getting the following error when I select a country
depend On Relationship not found on the Resource spefified for the Field "city" Please check you have set correct /App/Nova/Resource
The relationship is defined in each model
In Country model I have
public function cities()
{
return $this->hasMany(City::class, 'country_id');
}
In City model I have
public function country()
{
return $this->belongsTo(Country::class);
}
I tried to trace it down and didn't succeed. All of my nova resources are placed inside /App/Admin/Resources
, I don't think that is related though, but seeing the path /App/Nova/Resource
in the error made me wonder.
Any idea what might cause this issue?
@radwanic I am having the same issue, did you ever figure it out?
@mfairch nope, stopped using it for the lack of support
@radwanic did you find an alternative or roll your own?