Answer the question
In order to leave comments, you need to log in
Is it possible to connect prefix to id?
Is it possible to add a prefix to the id in the database? Now I have implemented only like this in the gridview
[
'attribute' => 'id_zakaz',
'headerOptions' => ['width' => '20'],
'value' => function($model) {
if ($model->id_sotrud == 2) {
return 'M-'.$model->id_zakaz;
}
return $model->id_zakaz;
print_r($model->id_zakaz);
}
],
Answer the question
In order to leave comments, you need to log in
print_r($model->id_zakaz);
- this will never be executed at all.
This:
if ($model->id_sotrud == 2) {
return 'M-'.$model->id_zakaz;
}
return $model->id_zakaz;
public function getMyCrazyHren(){
return ($this->id_sotrud == 2)?'M-'.$this->id_zakaz:$this->id_zakaz;
}
[
'attribute' => 'id_zakaz',
'headerOptions' => ['width' => '20'],
'value' => 'myCrazyHren',
]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question