Skip to content
Advertisement

how to set color warning when status “Waiting Confirmation”?

i want to make warning label for “waiting confirmation” status, the code as below :

->editColumn('status', function ($aduan) {
           $color = ($aduan->status == 'Pending') ? 'label-danger' : 'label-success';
           return '<span class="label ' . $color . '">' . $aduan->status . '</span>';
  })

Advertisement

Answer

Apologize to you first as I’m not a Laravel person, but this would be solve by just basic if-else. The code would look like this (you may encounter some syntax error but the idea is there):

->editColumn('status', function ($aduan) {
           if ($aduan->status == 'Pending'){
             $color = 'label-danger';
           } else if ($aduan->status == 'waiting confirmation'){
             $color = 'label-warning';
           } else{
             $color = 'label-success';
           } 

           return '<span class="label ' . $color . '">' . $aduan->status . '</span>';
  })
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement