Using the Laravel Optional Helper and the New Optional Closure - Laravel News

The Laravel `Optional` class and accompanying optional helper were introduced in Laravel 5.5. This class is useful to avoid those pesky “Trying to get property of non-object” errors in your code. Learn about the latest update to the optional helper and when to use optional vs the PHP7 n…