Skip to content
This repository was archived by the owner on Jul 16, 2021. It is now read-only.
This repository was archived by the owner on Jul 16, 2021. It is now read-only.

Introduce HigherOrderWhenProxy #1881

@netpok

Description

@netpok

I propose we introduce proxies for when on collections and the query builder.

Example use cases:

  • Collection sorting: $collection->when($field)->sortBy($field)
  • Database filtering: User::when($coreDataOnly)->select(['name', 'email'])->get()

Working principle:

  • if the value is true, then the called method is called on the target object and the result is returned
  • if the value is false, then the called method is skipped and the target is returned

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions