vendredi 23 novembre 2018

save if condition in database and fetching return value

In laravel view page I have if else condition field and want to get the variable from table field config_table have below code and I want to get status and title from the condition. How to get status and title value from table ? Config_table is the table name and have the field id, config_name, config_value id=5,config_name='approvalstatus' and config_value is given below.

@if($user->status_id=='1' && $user->reviewed!='0' )
            @if($sl_flag==0 && $requestor_role->role_id==7)
             <?php $status="Waiting for Review"; 
                   $title="Waiting for Review";
             ?>  
            @elseif($sl_flag==0)
             <?php $status="Waiting for dept.owner approval";
                   $title="Waiting for Deptment owner approval ";
             ?>
            @else
             <?php $status="Waiting for prac.owner approval";
                   $title="Waiting for practice owner approval";
             ?>
            @endif
        @elseif($user->status_id=='4' && $user->reviewed!='0')
        <?php $status="Waiting for super.prac.owner approval";
          $title="Waiting for Super practice owner approval";
        ?>
        @elseif( $user->status_id=='5' && $user->reviewed!='0')
        <?php $status="Waiting for approval";
          $title="Waiting for approval";
        ?>
        @elseif(($user->status_id=='3' || $user->status_id=='6' || $user->status_id=='7' || $user->status_id=='2' )&& $user->reviewed!='0')
        <?php $status="Waiting for NSA Approval";
          $title="Waiting for NSA Approval";
        ?>
    @endif

I have fetched the value as $bottom_lines=DB::table('config_table')->where('config_name','approvalStatus')->first()->config_value; print $bottom_lines;

Now print $bottom_lines; prints entire code how to get status and title from stored value in laravel view page



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire