Answers for "laravel inline if"

PHP
2

laravel inline if

{{ $var == "hello" ? "Hi" : "Goodbye" }}
Posted by: Guest on May-21-2021
0

write if and else in one line laravel

//in blade:
{{ ($data->position == 1) ? 'active' : 'disable'}}

//in Controller
$result = ($data->status == 1) ? 'active' : 'disable'
Posted by: Guest on November-08-2020
0

laravel inline if else if

{{$var == 'hello' ? 'Hi' : ($var == 'bye' ? 'Goodbye' : 'another option')}}
Posted by: Guest on May-21-2021

Browse Popular Code Answers by Language