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

[8.x] Modify has() method to support MorphTo relations #35050

Merged
merged 2 commits into from
Nov 2, 2020
Merged

[8.x] Modify has() method to support MorphTo relations #35050

merged 2 commits into from
Nov 2, 2020

Conversation

khalilst
Copy link
Contributor

@khalilst khalilst commented Nov 1, 2020

This PR modifies the has() method with min changes to support MorphTo relations.
Also, the following descendants of has() method inherit this feature:

protected function hasNested(...)
public function orHas(...)
public function doesntHave(...)
public function orDoesntHave(...)
public function whereHas(...)
public function orWhereHas(...)
public function whereDoesntHave(...)

In addition to the above feature the hasMorph() method and its descendants support the MorphTo relation as first argument (MorphTo|string):

/**
 * Add a polymorphic relationship count / exists condition to the query.
 *
 * @param  \Illuminate\Database\Eloquent\Relations\MorphTo|string  $relation
 * ....
 */
public function hasMorph($relation, ...)

public function orHasMorph($relation,...)
public function doesntHaveMorph($relation, ...)
public function whereHasMorph($relation, ...)
public function orWhereHasMorph($relation, ...)
public function orHasMorph($relation, ...)
public function doesntHaveMorph($relation, ...)
public function orDoesntHaveMorph($relation,...)

@taylorotwell taylorotwell merged commit 05f21fa into laravel:8.x Nov 2, 2020
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.

None yet

2 participants