Bladephp: Now with 7+ codeigniter, php, and laravel project 7+ php project From $18/Year From Rs. 1000/Year

Ternary operator in Laravel 5

by
Category:laravel
laravel
Ternary operator in Laravel 5

Just today, I was looking at using a ternary operator in Laravel's Blade templating system.

However, instead of writing a ternary statement, Blade provides you with the following convenient short-cut:

{{ $string or 'something' }}

In this example, if the $string variable exists, its value will be displayed. However, if it does not exist, the word something will be displayed.


0 Comments


Html code work in comment box