Answer the question
In order to leave comments, you need to log in
How to pass two parameters?
Hello everybody! Tell me how can I pass two parameters when switching to the view, in the code below I pass only one id parameter, and I also need to pass the contract_id parameter. Tell me how to do it right?
'add' => function ($url, $model, $key)
{
if($model->parent_id == false){
return Html::a('<span class="glyphicon glyphicon-plus"></span>', \yii\helpers\Url::to(['type/add', 'id' => $model->id]), ['data-id' => $model->id]);
}
public function actionAdd()
{
$model = new Type();
$model->loadDefaultValues();
$id = Yii::$app->request->get('id');
$model->parent_id = $id;
if ($model->load(Yii::$app->request->post()) && $model->save())
{
return $this->redirect(['index']);
}
else
{
return $this->render('create', [
'model' => $model,
]);
}
}
Answer the question
In order to leave comments, you need to log in
return Html::a('<span class="glyphicon glyphicon-plus"></span>', ['/type/add', 'id' => $model->id, 'contact_id'=>$model->contract_id] ]);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question