Support the ongoing development of Laravel.io →
posted 5 years ago
Blade
Syntax :
//https://www.pakainfo.com/laravel-6-switch-case-statements

@switch($variable)
      @case(value)
             // Implementation goes here
             break;
      @endcase

      @default_case
      @endcase
@endswitch

Example

@switch($action_input)
    @case(1)
        <span> `Your Primary Email Address` input is empty! </span>
        @break
    @case(2)
        <span>`Your Password` input is empty! </span>
        @break
    @default
        <span>Sorry, Something went wrong, please try again </span>
@endswitch


using IF ELSE (use if else approach.)
@if(!isset($wp_type))
    <b>All</b>
@else
    {{ HTML::linkRoute('audit.assign.form', 'All', array($audit_start_month, $mode)) }}
@endif
@if($wp_type == 'M')
    -- <b>Maintenance</b>
@else
    -- {{ HTML::linkRoute('audit.assign.form', 'Maintenance', array($audit_start_month, $mode, 'M')) }}
@endif
@if($wp_type == 'F')
    -- <b>Field</b>
@else
    -- {{ HTML::linkRoute('audit.assign.form', 'Field', array($audit_start_month, $mode, 'F')) }}
@endif
@if($wp_type == 'D')
    -- <b>Drilling</b>
@else
    -- {{ HTML::linkRoute('audit.assign.form', 'Drilling', array($audit_start_month, $mode, 'D')) }}
@endiflarta

facing solution : https://www.pakainfo.com/laravel-6-switch-case-statements

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

pakainfo pakainfo Joined 3 Apr 2020

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.