public $search;
$query->orFilterWhere(['like', 'sotrud_name', $this->search])
->orFilterWhere(['like', 'description', $this->search])
->orFilterWhere(['like', 'information', $this->search])
->orFilterWhere(['like', 'name', $this->search]);
[
'attribute' => 'id_zakaz',
'format' => 'text',
'value' => 'idZakaz.description',
],
'value' => Courier::findOne('id_zakaz')->idZakaz->description,
class Courier extends \yii\db\ActiveRecord
{
public static function tableName()
{
return 'courier';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id_zakaz'], 'integer'],
[['data_to', 'data_from'], 'safe'],
[['commit'], 'string'],
[['to', 'from'], 'string', 'max' => 50],
[['id_zakaz'], 'exist', 'skipOnError' => true, 'targetClass' => Zakaz::className(), 'targetAttribute' => ['id_zakaz' => 'id_zakaz']],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'id_zakaz' => 'Id Zakaz',
'to' => 'To',
'data_to' => 'Data To',
'from' => 'From',
'data_from' => 'Data From',
'commit' => 'Commit',
];
}
/**
* @return \yii\db\ActiveQuery
*/
public function getIdZakaz()
{
return $this->hasOne(Zakaz::className(), ['id_zakaz' => 'id_zakaz']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getZakazs()
{
return $this->hasMany(Zakaz::className(), ['id_shipping' => 'id']);
}
public function rules()
{
return [
[['id_zakaz'], 'integer'],
[['data_to', 'data_from'], 'safe'],
[['commit'], 'string'],
[['to', 'from'], 'string', 'max' => 50],
[['id_zakaz'], 'exist', 'skipOnError' => true, 'targetClass' => Zakaz::className(), 'targetAttribute' => ['id_zakaz' => 'id_zakaz']],
];
}
public function getIdZakaz()
{
return $this->hasOne(Zakaz::className(), ['id_zakaz' => 'id_zakaz']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getZakazs()
{
return $this->hasMany(Zakaz::className(), ['id_shipping' => 'id']);
}
public function rules()
{
return [
[['srok', 'minut', 'number', 'description', 'phone'], 'required'],
[['id_zakaz', 'id_tovar', 'oplata', 'fact_oplata', 'number', 'status', 'action', 'id_sotrud', 'phone', 'id_shipping'], 'integer'],
[['srok', 'minut', 'data'], 'safe'],
[['comment'], 'string'],
[['prioritet'], 'string', 'max' => 36],
['status', 'default', 'value' => self::STATUS_NEW],
['id_sotrud', 'default', 'value' => Yii::$app->user->getId()],
['data', 'default', 'value' => date('Y-m-d')],
[['description', 'information'], 'string', 'max' => 500],
[['email', 'name', 'img', 'maket'],'string', 'max' => 50],
[['file'], 'file', 'skipOnEmpty' => true],
[['id_sotrud'], 'exist', 'skipOnError' => true, 'targetClass' => User::className(), 'targetAttribute' => ['id_sotrud' => 'id']],
[['id_tovar'], 'exist', 'skipOnError' => true, 'targetClass' => Tovar::className(), 'targetAttribute' => ['id_tovar' => 'id']],
[['id_shipping'], 'exist', 'skipOnError' => true, 'targetClass' => Courier::className(), 'targetAttribute' => ['id_shipping' => 'id']],
];
}
public function getIdShipping()
{
return $this->hasOne(Courier::className(), ['id' => 'id_shipping']);
}
<?php if (Yii::$app->user->can('admin')): ?>
<?php if ($model->action == 0) { ?>
<?= Html::a('Восстановить заказ', ['restore', 'id' => $model->id_zakaz], ['class' => 'btn btn-primary pull-right',
'data' => [
'confirm' => 'Вы действительно хотите восстановить заказ',
'method' => 'post',
],
]) ?>
<?php } ?>
<?php endif ?>
В дебаге смотрю нет этого запроса