Skip to content

[7.x] Call named scope and consistent method naming#32631

Merged
taylorotwell merged 3 commits into
7.xfrom
named-scopes
May 1, 2020
Merged

[7.x] Call named scope and consistent method naming#32631
taylorotwell merged 3 commits into
7.xfrom
named-scopes

Conversation

@GrahamCampbell

@GrahamCampbell GrahamCampbell commented May 1, 2020

Copy link
Copy Markdown
Collaborator
  1. The model is the source of truth for if a scope exists, but then the builder bypasses it to call the scope method. Instead, we should delegate to the model. This PR addresses this, and provides a reusable way to apply scopes.
  2. [7.x] Add hasScope function to the Base Model #32622 added hasScope, but the name hasNamedScope would be more consistent, since callScope expects a full on callable and callNamedScope expects the actual scope name.

@GrahamCampbell GrahamCampbell changed the title [7.x] Implement call named scope [7.x] Implement call named scope and consitent naming May 1, 2020
@GrahamCampbell GrahamCampbell changed the title [7.x] Implement call named scope and consitent naming [7.x] Call named scope and consistent method naming May 1, 2020
@GrahamCampbell
GrahamCampbell marked this pull request as ready for review May 1, 2020 16:56
Comment thread src/Illuminate/Database/Eloquent/Builder.php
@taylorotwell
taylorotwell merged commit dda3174 into 7.x May 1, 2020
@GrahamCampbell
GrahamCampbell deleted the named-scopes branch May 1, 2020 18:33
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