Working With If Else in Laravel 5.3 using Blade

By January 22, 2017Laravel

As we have seen in earlier tutorial about Loops, let see how to use if statements in Blade Template engine.

If Else Condition

In above code, we have checked if $var is empty, if it is empty output It is empty, else output It is not empty. if condition can also be used for comparison. For example:

Unless statement

Unless is generally "if not" condition. For example:

In this example if $var is empty, it will not process this loop and exit.