Appearance
firstOrFail 方法与 first 方法相同;
firstOrFail
first
如果没有找到结果则会抛出 Illuminate\Support\ItemNotFoundException 异常。
Illuminate\Support\ItemNotFoundException
collect([])->firstOrFail(); // Throws ItemNotFoundException... collect([1, 2, 3, 4]) ->firstOrFail( fn (int $value, int $key) => $value > 5 ); // Throws ItemNotFoundException...