New in Laravel 5.5

Let’s dive into the new Laravel 5.5 features that’ll be available when it’s released

Exception helper functions

New to Laravel 5.5 are two exception helper functions and i know we do love helper functions. I thought to myself the first time i saw these functions whether we really need helper functions to throw exceptions based on a particular condition, but once i start using this, it actually made sense and cleaned up code.

Lets dive in

I will use an hypothetical case where we have a name method which returns the name of a user and i want to throw an exception if this doesn’t exist. The traditional way to do this is to is by an if statement if a condition isn’t met as shown below