Hello guys,
I am trying to save user-id in the table, but it is not saved, need this for creating and updating.
public function actionCreate()
{
$product = new Product();
$catList = Category::getList();
$officeList = Office::getOffice();
$jewList = Jewerly::getList();
$this->layout = false;
if ($product->load(Yii::$app->request->post()) && $product->save()) {
$product->created_by = Yii::$app->user->identity->id;
return $this->redirect(['view', 'id' => $product->id]);
}
return $this->renderAjax('create-modal', [
'product' => $product,
'catList' => $catList,
'officeList' => $officeList,
'jewList' => $jewList,
]);
}
Thank you for any help.