问题
In the above both models i commented the method itemDestribution() but still it is working
回答1:
This relation displays a Data because of following reasons.
In your
ItemDestributionModel, You have set relation withUserModelandItemModelboth.In your
ItemModelandUserModelyou haven't declare any public function and add Relation Class.
When you call UserModel it will find hasMany Relationship in ItemDestributionModel and user() function is available with belongsTo relationship.
That's why laravel fetch data without declaring public function. But you should declare relationship inside public function. :)
来源:https://stackoverflow.com/questions/39511218/why-hasmany-relation-still-working-even-i-removed-relation-in-laravel