Skip to content

Commit

Permalink
Modify collection except method to accept array of collection keys (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
amaelftah authored and taylorotwell committed Jan 16, 2018
1 parent 07d11e3 commit c1e1884
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Illuminate/Support/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ public function every($key, $operator = null, $value = null)
public function except($keys)
{
if ($keys instanceof self) {
$keys = $keys->keys()->all();
$keys = $keys->all();
} elseif (! is_array($keys)) {
$keys = func_get_args();
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Support/SupportCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -974,11 +974,11 @@ public function testExcept()

$this->assertEquals(['first' => 'Taylor'], $data->except(['last', 'email', 'missing'])->all());
$this->assertEquals(['first' => 'Taylor'], $data->except('last', 'email', 'missing')->all());
$this->assertEquals(['first' => 'Taylor'], $data->except(collect(['last' => 'Otwell', 'email' => 'taylorotwell@gmail.com', 'missing']))->all());
$this->assertEquals(['first' => 'Taylor'], $data->except(collect(['last', 'email', 'missing']))->all());

$this->assertEquals(['first' => 'Taylor', 'email' => 'taylorotwell@gmail.com'], $data->except(['last'])->all());
$this->assertEquals(['first' => 'Taylor', 'email' => 'taylorotwell@gmail.com'], $data->except('last')->all());
$this->assertEquals(['first' => 'Taylor', 'email' => 'taylorotwell@gmail.com'], $data->except(collect(['last' => 'Otwell']))->all());
$this->assertEquals(['first' => 'Taylor', 'email' => 'taylorotwell@gmail.com'], $data->except(collect(['last']))->all());
}

public function testPluckWithArrayAndObjectValues()
Expand Down

0 comments on commit c1e1884

Please sign in to comment.