File tree Expand file tree Collapse file tree 3 files changed +8
-8
lines changed
tests/Integration/Database Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 44
55use Illuminate \Container \Container ;
66use Illuminate \Database \MultipleRecordsFoundException ;
7- use Illuminate \Database \NoRecordsFoundException ;
7+ use Illuminate \Database \RecordsNotFoundException ;
88use Illuminate \Pagination \LengthAwarePaginator ;
99use Illuminate \Pagination \Paginator ;
1010
@@ -150,24 +150,24 @@ public function first($columns = ['*'])
150150 }
151151
152152 /**
153- * Execute the query and get the first result if it's the sole.
153+ * Execute the query and get the first result if it's the sole matching record .
154154 *
155155 * @param array|string $columns
156156 * @return \Illuminate\Database\Eloquent\Model|object|static|null
157157 *
158- * @throws \Illuminate\Database\NoRecordsFoundException
158+ * @throws \Illuminate\Database\RecordsNotFoundException
159159 * @throws \Illuminate\Database\MultipleRecordsFoundException
160160 */
161161 public function sole ($ columns = ['* ' ])
162162 {
163163 $ result = $ this ->take (2 )->get ($ columns );
164164
165165 if ($ result ->isEmpty ()) {
166- throw new NoRecordsFoundException () ;
166+ throw new RecordsNotFoundException ;
167167 }
168168
169169 if ($ result ->count () > 1 ) {
170- throw new MultipleRecordsFoundException () ;
170+ throw new MultipleRecordsFoundException ;
171171 }
172172
173173 return $ result ->first ();
Original file line number Diff line number Diff line change 44
55use RuntimeException ;
66
7- class NoRecordsFoundException extends RuntimeException
7+ class RecordsNotFoundException extends RuntimeException
88{
99 //
1010}
Original file line number Diff line number Diff line change 44
55use Illuminate \Contracts \Pagination \LengthAwarePaginator ;
66use Illuminate \Database \MultipleRecordsFoundException ;
7- use Illuminate \Database \NoRecordsFoundException ;
7+ use Illuminate \Database \RecordsNotFoundException ;
88use Illuminate \Database \Schema \Blueprint ;
99use Illuminate \Support \Carbon ;
1010use Illuminate \Support \Facades \DB ;
@@ -52,7 +52,7 @@ public function testSoleFailsForMultipleRecords()
5252
5353 public function testSoleFailsIfNoRecords ()
5454 {
55- $ this ->expectException (NoRecordsFoundException ::class);
55+ $ this ->expectException (RecordsNotFoundException ::class);
5656
5757 DB ::table ('posts ' )->where ('title ' , 'Baz Post ' )->sole ();
5858 }
You can’t perform that action at this time.
0 commit comments