Operator "or" blade laravel does not work

0

When I try to use the "or" operator on the blade it renders the wrong and undefined variable. I'm calling it like this:

  {{ $confirmed or false }}

But it's compiling like this:

  <?php echo e($confirmed or false); ?>
    
asked by anonymous 25.10.2018 / 22:51

2 answers

1

The correct basic usage is:

{{ $confirmed or 'false' }}

In case you are trying to put false as an element, not a string or variável .

    
25.10.2018 / 22:55
0

Try this:

{{ isset($confirmed) ? 'valor se ok' : 'valor se nao existe'; }}

or use the form below to return the value of the variable itself:

{{ isset($confirmed) ? $confirmed : 'valor se nao existe'; }}

    
30.10.2018 / 01:04