Posted: 02-09-2017

Laravel 5.5 Optional Objects

Laravel 5.5 Optional Objects

Lavavel 5.5  comes with a  new `Optional` class and  helper optional() lets you perform calls on an object that might be null. Very useful for nullable relations.

// return null if user has not a profile

or in blade
{!! optional($product->category)->title !!}


Learning More About Laravel 5.5 Optional Objects