Inverse Relations
#35629
Replies: 2 comments 6 replies
-
You can use the echo $user2->is($user) ? 'same' : 'not the same'; // same Reference: https://laravel.com/docs/8.x/eloquent#comparing-models |
Beta Was this translation helpful? Give feedback.
6 replies
-
#51582 essentially introduced chaperons which should be what you asked for |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Relation declarations are often reciprocal between two model classes. For example,
User
is related toOrder
via the orders relation, and Order is related back to User via the user relation.We would think $user and $user2 are the same, but they are not!
Can we support inverseOf syntax like yii?
Beta Was this translation helpful? Give feedback.
All reactions