php - How can I store ternary operator to the html element in laravel blade -
I have html elements, for example this would be an image, and I wanted to check my unit for some situations I do not have to add this element or some classes on this like:
id, $ deleted)? 'Hidden': ''} }} "))}} & Lt; / Div & gt; So, I have an exception to this line: "array for string conversion" Tell me, please, how can I avoid it?
You should use:
& lt; Div class = "btn btn-default" & gt; {{HTML :: image ('// image.png', '', array ("class" => in_array ($ prod-> id, $ deleted)? 'Hidden': '')) }} & Lt; / Div & gt; Of course $ prod-> ID should be single element (string, integer, float) and $ deleted array here if you still have this message, then you $ Prod- & gt; IDs and $ deleted have to be checked.
Comments
Post a Comment