Laravel and @if statement inside javascript object literal
<p>I hope i wrote it correctly, as i remember when you have an array options in javascript these are called object literals. I have a problem i can't find how to use @if statement in object literal. 
I have a small site and everything is located inside welcome.blade.php template so i don't have separate javascript file, the function that i use is just at the bottom of the template inside  tags. So here is the whole function that i have</p>

<pre><code>    &lt;script&gt;
        var employees = [
            @foreach ($workers-&gt;chunk(20) as $chunk)
            [
                @foreach ($chunk as $worker)
                    {
                        innerHTML:'&lt;div class="container-fluid full-height"&gt;&lt;div class="row full-height"&gt;&lt;div class="col-xs-3 col-sm-3 col-md-3 col-lg-3 full-height"&gt;&lt;div class="person-info"&gt;&lt;blockquote&gt;&lt;h1&gt;{{ $worker-&gt;first_name }} {{ $worker-&gt;last_name }}&lt;/h1&gt;{{{ $worker-&gt;function !== '') ? &lt;footer&gt;{{ $worker-&gt;function }}&lt;/footer&gt; : '' }}}&lt;/blockquote&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="col-xs-5 col-sm-5 col-md-5 col-lg-5 col-lg-offset-1 col-md-offset-1 col-sm-offset-1 full-height"&gt;&lt;div class="person-photo"&gt;&lt;img class="img-responsive" src="thumbs/{{ $worker-&gt;image }}" /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;',
                        src:"thumbs/{{ $worker-&gt;thumbnail }}"
                    },
                @endforeach
            ],
            @endforeach
        ]
    &lt;/script&gt;
</code></pre>

<p>As you can see i need to get all the info from <code>$workers</code> inside <code>innerHTML</code> and  that should be output as html content, but as some fields will be empty in database  so i need to write @if statement if those fields are not empty to display some code </p>

<pre><code>{{{ $worker-&gt;function !== '') ? '&lt;footer&gt;{{ $worker-&gt;function }}&lt;/footer&gt;' :  '' }}}
</code></pre>

<p>But i can't get it how to get the if statement inside <code>innerHTML</code> content to work.</p>

<p>EDIT: The closest that i got it working is like this:</p>

<pre><code>'{{ $worker-&gt;function ? "&lt;footer&gt;  $worker-&gt;function  &lt;/footer&gt;" : "" }}' +
</code></pre>

<p>But this just renders the output completely with <code>&lt;footer&gt;</code> so now i have like </p>

<p>John Doe <code>&lt;footer&gt;</code> Quality manager <code>&lt;/footer&gt;</code></p>