You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-36Lines changed: 13 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -100,21 +100,15 @@ Note: Querying morph to relationships only supports one morphable type at a time
100
100
Now, let's say you want to apply a condition to the join you are making. You simply need to pass a callback as the second parameter to the `joinRelationship` method.
101
101
102
102
```php
103
-
User::joinRelationship('posts', function ($join) {
@@ -265,9 +245,7 @@ select users.* from users inner join posts on posts.user_id = posts.id and posts
265
245
If your model have global scopes applied to it, you can enable the global scopes by calling the `withGlobalScopes` method in your join clause, like this:
266
246
267
247
```php
268
-
UserProfile::joinRelationship('users', function ($join) {
There's, though, a gotcha here. Your global scope **cannot** type-hint the `Eloquent\Builder` class in the first parameter of the `apply` method, otherwise you will get errors.
@@ -286,9 +264,8 @@ Please note that although the methods are similar, you will not always get the s
0 commit comments