title: Using Blade templating in HTML attribute
body: <p>I want to dynamically change the attribute value for an HTML tag in a Blade template.</p>
  
  <pre><code>&lt;span class="badge badge-blade-difficulty"&gt;
  </code></pre>
  
  <p>In the code above, I want to change blade to a value that can differ. I tried many things like </p>
  
  <pre><code>{{&lt;span class=&amp;quot;badge badge-$blogpost-&gt;difficulty&amp;quot;&gt;}}
  </code></pre>
  
  <p>or </p>
  
  <pre><code>&lt;span class="badge badge-{{$blogpost-&gt;difficulty}}"&gt;
  </code></pre>
  
  <p>But these result in an error. Can anyone help? Thanks!</p>