Created
July 4, 2017 12:46
-
-
Save abdullahbutt/ec13905dc5312be125f0cc84b40ae650 to your computer and use it in GitHub Desktop.
ternary operator blade if else on single line
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| How to make if else statement on a single line in a blade? How to compress the below on to a single line. | |
| @if ($var === "hello") | |
| Hi | |
| @else | |
| goodbye | |
| @endif | |
| Solution: | |
| {{ $var === "hello" ? "Hi" : "Goodbye" }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment