0

My database column "status" stores "0 or 1" value but I want to display "Enable" or "disable"

enter image description here

Hothi Jimit
  • 380
  • 7
  • 20

1 Answers1

0

Try this... This might be helpful to you.

Modify code as per your need.

  [
            'attribute' => 'status',
            'value' => function ($model, $key, $index, $widget) {
        if ($model->status == 0) {
            $status = 'disable';
        } elseif ($model->status == 1) {
            $status = 'Enable';
        } else {
            $status = 'Completed';
        }
        return $status;
    }
    ]
vijay nathji
  • 1,608
  • 13
  • 23