staudenmeir / eloquent-has-many-deep

Laravel Eloquent HasManyThrough relationships with unlimited levels
MIT License
2.67k stars 157 forks source link

hasManyDeep with 4 level doesn't work #242

Closed bhattji closed 1 month ago

bhattji commented 2 months ago

I am trying to access the 4th table, but it gives errors cities.city_id doesn't exists. but why should it look for city_id in cities table? it should look for id

//hasManyDeeo
    public function asset_depreciations()
    {
        return $this->hasManyDeep(AssetDepreciation::class, [City::class, Location::class, Asset::class]);
    }
staudenmeir commented 2 months ago

Hi @bhattji, Please share the migrations of all tables involved in this relationship. In which model is the asset_depreciations relationship defined?