Skip to content

Commit 880ffe3

Browse files
committed
Merge branch '8.x'
# Conflicts: # CHANGELOG-8.x.md # src/Illuminate/Collections/Collection.php # src/Illuminate/Foundation/Application.php # src/Illuminate/Testing/TestResponse.php
2 parents 4f601bd + 673d71d commit 880ffe3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Collection.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -1177,13 +1177,15 @@ public function firstOrFail($key = null, $operator = null, $value = null)
11771177
? $this->operatorForWhere(...func_get_args())
11781178
: $key;
11791179

1180-
$items = $this->unless($filter == null)->filter($filter);
1180+
$placeholder = new stdClass();
11811181

1182-
if ($items->isEmpty()) {
1182+
$item = $this->first($filter, $placeholder);
1183+
1184+
if ($item === $placeholder) {
11831185
throw new ItemNotFoundException;
11841186
}
11851187

1186-
return $items->first();
1188+
return $item;
11871189
}
11881190

11891191
/**

0 commit comments

Comments
 (0)