php - PHP5 Laravel - Replace all object attributes that are equal to a value -


i'm building website laravel 5 framework , i'm little trouble.

i extracted array of objects database eloquent model , passed view.

the format of array that:

array[object1{prop1:xxxx, prop2: xxxx}, object2{prop1:xxxx,prop2:xxxx}...] 

the problem proprieties values false when print {{ object1->propriety }} doesn't print anything.

i want replace false proprieties in objects in array without placing statement if (!obj1->prop) something times, because objects many.

thank you.

you can use ternary operators in views:

{{ $object->boolean_attribute ? 'true' : 'false' }} 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -