Hi i want to send $tipo_empresa value from model to modelSearch to personalize search function but i can’t do it
Hope you can you help
Warm Regards
In ContactController.php
public function actionIniciativaPrivada()
{
$tipo_empresa = 1; // I need to send this value to ContactSearch.php
$searchModel = new ContactosSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('iniciativa-privada', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
In ContactSearch.php
public function search($params)
{
$query = Contactos::find();
$query->joinWith('cuenta');
$query->where('tipocuenta_id = ' . $tipo_empresa ); // This value is from ContactController
...
}