Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[9.x] Add firstOr methods to relationship classes #38694

Merged
merged 1 commit into from
Sep 8, 2021
Merged

[9.x] Add firstOr methods to relationship classes #38694

merged 1 commit into from
Sep 8, 2021

Conversation

ganyicz
Copy link
Contributor

@ganyicz ganyicz commented Sep 6, 2021

This PR unifies the behavior of firstOr method on relationships which override the first method.

Unlike every other firstOrX method, the firstOr method doesn't handle the relationship query result as you would expect. Eg. using BelongsToMany, you don't get the pivot attribute because the call is forwarded to the base builder.

@GrahamCampbell GrahamCampbell reopened this Sep 6, 2021
@GrahamCampbell GrahamCampbell changed the title Add firstOr methods to relationship classes [9.x] Add firstOr methods to relationship classes Sep 6, 2021
@taylorotwell taylorotwell merged commit 75969f7 into laravel:master Sep 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants