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

Scope support #4

Merged
merged 10 commits into from
Aug 4, 2019
Merged

Scope support #4

merged 10 commits into from
Aug 4, 2019

Conversation

brendt
Copy link
Collaborator

@brendt brendt commented Apr 12, 2019

This PR is based on model-support for review. #1 must be merged before this one can target master.

@brendt
Copy link
Collaborator Author

brendt commented Apr 12, 2019

Some questions:

  • Could we improve the naming of resolveEnumerables and make it protected?
  • Should we use the spread operator instead of arrays? Eg Blog::whereEnum('status', StatusEnum::DRAFT(), StatusEnum::PUBLISHED()). I gave this some thought and decided arrays are more clear, but I'd like to hear your input.

src/HasEnums.php Outdated Show resolved Hide resolved
@brendt brendt changed the base branch from model-support to master April 12, 2019 10:49
@Gummibeer
Copy link
Collaborator

After spatie/enum:2.1.0 we don't need the mapping of values in the scopes anymore. Instead the scopes should also respect the possible cast to integer - introduced in 61e93c9 .
I would also like to have a whereEnum($column, $value) and a second whereInEnum($column, $values) - same for not. I think that it should be possible to have a scope which would fail if multiple values are passed. So far I know the default laravel where methods also don't auto-switch depending on the argument type(?).

@Gummibeer Gummibeer marked this pull request as ready for review July 15, 2019 14:43
@Gummibeer
Copy link
Collaborator

@brendt I've opened this PR because it's now on master level and I've also added the missing or scopes.

@Gummibeer
Copy link
Collaborator

@freekmurze could you check this PR? @brendt and I have written the code.

Copy link
Member

@freekmurze freekmurze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one little nitpick

src/HasEnums.php Outdated Show resolved Hide resolved
@Gummibeer Gummibeer merged commit f30e14e into master Aug 4, 2019
@Gummibeer Gummibeer deleted the scope-support branch August 4, 2019 21:41
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