Support the ongoing development of Laravel.io →
posted 9 years ago
Views
Last updated 2 years ago.
0

isset ?

0

A couple of ways come to mind. There's the property_exists function - here's the link to it. You can scatter this around your application, or you can look into the magic __get function. Here's the link. You can couple the __get with the property_exists function to return null or blank if it doesn't exist on the object, thus eliminating your issue.

You may want to throw this functionality in a trait for reuse-ability too.

Last updated 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

vishok vishok Joined 25 Jun 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.