From 2093ed9ebd41788bb3f96270234bda2f707c5fb2 Mon Sep 17 00:00:00 2001 From: Joseph Silber Date: Tue, 27 Dec 2016 11:47:27 -0500 Subject: [PATCH] Add "contains" to higher order function proxy (#17000) --- src/Illuminate/Support/Collection.php | 4 ++-- tests/Support/SupportCollectionTest.php | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Support/Collection.php b/src/Illuminate/Support/Collection.php index 8afa354500ea..6b6e5143834d 100644 --- a/src/Illuminate/Support/Collection.php +++ b/src/Illuminate/Support/Collection.php @@ -32,8 +32,8 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate * @var array */ protected static $proxies = [ - 'each', 'every', 'filter', 'first', 'map', 'partition', - 'reject', 'sortBy', 'sortByDesc', 'sum', + 'contains', 'each', 'every', 'filter', 'first', 'map', + 'partition', 'reject', 'sortBy', 'sortByDesc', 'sum', ]; /** diff --git a/tests/Support/SupportCollectionTest.php b/tests/Support/SupportCollectionTest.php index 212ff326b479..ba9e364a1efc 100755 --- a/tests/Support/SupportCollectionTest.php +++ b/tests/Support/SupportCollectionTest.php @@ -1268,6 +1268,11 @@ public function testContains() $this->assertTrue($c->contains('date')); $this->assertTrue($c->contains('class')); $this->assertFalse($c->contains('foo')); + + $c = new Collection([['a' => false, 'b' => false], ['a' => true, 'b' => false]]); + + $this->assertTrue($c->contains->a); + $this->assertFalse($c->contains->b); } public function testContainsStrict()