I've created an ActiveRecord Model where a user enters their email and gets added to a database in Yii2. When they're added to the database, I want to update one of my properties based on which view they entered the information from. I know Yii2 lets you set a default value in your model, like
public function rules()
{
return [
[['view'], 'default', 'value' => a]
]
}
But I'm not sure how to set a different default value based on each view. In my view where I have the form->field($model, 'email') and submit for user input, I tried setAttribute and setAttributes and creating my own set method, but they all fail to set the property (I'm guessing they'd work if I say queried my db and performed them on an already existing instance of my Model).
I'm sure I'm overlooking something really simple
\Yii::$app->controller->action->id? you can put it in therulesfunction instead ofa- Ziki