Hello Devs,
In this tutorial, we will learn Laravel Blade Switch Case Example
Switch statements can be constructed using the @switch, @case, @break, @default and @endswitch directives:
Follow this step by step guide below,
Syntax:
@switch($i)
@case(1)
First case...
@break
@case(2)
Second case...
@break
@default
Default case...
@endswitch
Example:
<!DOCTYPE html>
<html>
<head>
<title>Laravel Blade Switch Case Example - rathorji.in</title>
</head>
<body>
@switch($i)
@case(1)
First case...
@break
@case(2)
Second case...
@break
@default
Default case...
@endswitch
</body>
</html>
May this example help you.