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

[5.5] Add a firstWhere method to the Collection class #22261

Merged
merged 1 commit into from Nov 30, 2017

Conversation

Projects
None yet
4 participants
@JosephSilber
Contributor

JosephSilber commented Nov 30, 2017

$firstActiveUser = $users->firstWhere('active', true);
@@ -45,6 +45,19 @@ public function testFirstWithDefaultAndWithoutCallback()
$this->assertEquals('default', $result);
}
public function testFirstWehre()

This comment has been minimized.

@Dylan-DPC

Dylan-DPC Nov 30, 2017

Contributor

typo in function name 😛

@Dylan-DPC

Dylan-DPC Nov 30, 2017

Contributor

typo in function name 😛

@taylorotwell taylorotwell merged commit ef7d16d into laravel:5.5 Nov 30, 2017

2 checks passed

continuous-integration/styleci/pr The StyleCI analysis has passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@taylorotwell

This comment has been minimized.

Show comment
Hide comment
@taylorotwell

taylorotwell Nov 30, 2017

Member

Just needed this yesterday 😄

Member

taylorotwell commented Nov 30, 2017

Just needed this yesterday 😄

@jordyvandomselaar

This comment has been minimized.

Show comment
Hide comment
@jordyvandomselaar

jordyvandomselaar Nov 30, 2017

Where's firstOrFailWhere?

jordyvandomselaar commented Nov 30, 2017

Where's firstOrFailWhere?

@JosephSilber

This comment has been minimized.

Show comment
Hide comment
@JosephSilber

JosephSilber Nov 30, 2017

Contributor

@jordyvandomselaar right here:

$value = $c->firstWhere(...) ?? throw new Exception(...);
Contributor

JosephSilber commented Nov 30, 2017

@jordyvandomselaar right here:

$value = $c->firstWhere(...) ?? throw new Exception(...);
@jordyvandomselaar

This comment has been minimized.

Show comment
Hide comment
@jordyvandomselaar

jordyvandomselaar Nov 30, 2017

No no no, if we're adding methods for the heck of it that provide no value anyways we're gonna need this.

jordyvandomselaar commented Nov 30, 2017

No no no, if we're adding methods for the heck of it that provide no value anyways we're gonna need this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment