Skip to content

Conversation

@calebporzio
Copy link
Contributor

Here is a recent snippet of code where "unless" would have been useful:

without "unless"

$query->when($sortColumn !== 'title', function ($query) {
    return $query->orderBy($sortColumn, 'desc');
})

with "unless"

$query->unless($sortColumn === 'title', function ($query) {
    return $query->orderBy($sortColumn, 'desc');
})

I also would like this method in Collection.php - if people like the concept, I'll submit another PR, but let's see how this goes.

Thanks for all the hard work!

  • Caleb

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