Skip to content

Conversation

@staudenmeir
Copy link
Contributor

#37956 added the DecoratesQueryBuilder trait to improve type hinting. delete() is a special case as its method signature in Eloquent\Builder is different from Query\Builder. Only the base query builder has an $id parameter, the Eloquent one doesn't:

public function delete()

public function delete($id = null)

The trait is used in relationship classes and so the IDE suggests that $user->posts()->delete(1) works, but the parameter is actually ignored because Eloquent\Builder::delete() doesn't pass it on to Query\Builder::delete().

@taylorotwell taylorotwell merged commit eb66b96 into laravel:master Dec 6, 2021
@staudenmeir staudenmeir deleted the delete branch December 6, 2021 14:58
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.

2 participants