Q:

Call function in fields in model yii2

I am new to yii2 and how to call a function fields?
public function fields{
    'id',
    'name'
}

Thanks

A:

Try This.
public function fields() {
 'id',
'name',
'city'
}

 public function getCity(){
  return "City";
 }

