lundi 19 mars 2018

Correct appoach for rendering optional param in blade

I noticed that below construction is not correct for Blade

<div class="constant @if($some_condition)optional@endif">

cause this is converted to in PHP which is invalide

<div class="constant <?php if($some_condition): ?>optional<?php endif; ?>">

To make this statement work I need to put close tag on different line but it looks very bad, especially if there are many others attribute.

<div class="constant @if($some_condition)optional
@endif" data-id="1" tabindex="2" data-etc="...">

What is the right way of rendering such kind of conditions in Blade?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2G1EwQz
via IFTTT

Aucun commentaire:

Enregistrer un commentaire