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
Post a Comment