Generate dynamic css classes in laravel-blade
<p>I'm in a classical scenario where i want based on wheter an error has occurred or not to change the css classes. As shown below, where has-error should change accordingly.</p>

<pre><code>&lt;div class="form-group has-error"&gt;
</code></pre>

<p>The project is in Laravel, where we mainly want to do everything in <code>Blade</code> as of now, we came up with the following solution which works, but does not look pretty or intuitive at all, so the question is, is there a more optimal way of doing this?</p>

<pre><code>&lt;div class="form-group
@if($errors-&gt;has('email'))
        has-error
@endif
"&gt;
</code></pre>