@switch(): conditional directive is part of the conditional
loop operator directives. It is being used to check the value of an item.
@php: $apple = 'Apple'; @php;
@switch('fruit'):
@case('pear'): Pear
@break;
@case('apple'): {{ $apple }}
@break;
@default: Fruit
@endswitch;
Fruit
@php:, we can similarly use the new smart php directive
{{: $apple = 'Apple'; }}
@switch('fruit'):
@case('pear'): Pear
@break;
@case('apple'): {{ $apple }}
@break;
@default: Fruit
@endswitch;