Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ If you just need to retrieve a single row from a database table, you may use the

return $user->email;

If you would like to retrieve a single row from a database table, but throw an `Illuminate\Database\RecordNotFoundException` if no matching row is found, you may use the `firstOrFail` method. If the `RecordNotFoundException` is not caught, a 404 HTTP response is automatically sent back to the client:

$user = DB::table('users')->where('name', 'John')->firstOrFail();

If you don't need an entire row, you may extract a single value from a record using the `value` method. This method will return the value of the column directly:

$email = DB::table('users')->where('name', 'John')->value('email');
Expand Down