When you're building a Laravel application, it's tempting to reach for abort() whenever something goes wrong, let's take a flight booking app. trying to check a user in to a flight:

abort(422, 'Passenger has already checked in.');

abort(403, 'Boarding has closed for this flight.');

abort(404, 'Booking not found.');

Enter fullscreen mode