Question: I have this in my view

```
'columns' => [
    ['class' => 'yii\grid\SerialColumn'],
    [
        'attribute' => 'order_delivery_address_city',
        'value' => 'address.order_delivery_address_city'
    ],

```

which shows field like '1' or '2' or '3'... How to change it to be like this 

```
if (address.order_delivery_address_city == '1') {
    'value' => 'New-York'
}

```

Answer: 
Try:

```
    'columns' => [
        ['class' => 'yii\grid\SerialColumn'],
        [
            'attribute' => 'order_delivery_address_city',
            'value' => function($model){
                         if($model->address->order_delivery_address_city == '1'){
                            return 'New-York';
                         }
                       }
        ],

```
Try this:

```
             [
                'attribute'=>'order_delivery_address_city',
                'value'=>function($model){
                  return $model->order_delivery_address_city=='1' ? 'New-York':'Anything else';
                }
            ],

```