In addition to findOrFail(), there's also Eloquent method firstOrFail() which will return 404 page if no records for query are found.
$user = User::where('email', 'user@example.com')->firstOrFail();
In addition to findOrFail(), there's also Eloquent method firstOrFail() which will return 404 page if no records for query are found.
$user = User::where('email', 'user@example.com')->firstOrFail();