mercredi 17 mai 2017

Laravel 5.1 Cant return Null Field in Relation

How to prevent "Trying to get property of non-object" from an empty field. I have $employee->genderRelation->name; but gender field in my Employee table is empty or not set yet. how to return it into an empty string instead of returning error?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire