public function actionUpdateshop() { $data = json_decode(file_get_contents("php://input")); //print_R($data);exit; //echo $data->id;exit; $model = Shop::findOne($data->shopid); $model->ShopName = $data->ShopName; $model->Address1 = $data->Address1; $model->ContactNo = $data->ContactNo; $model->owner_name = $data->owner_name; $model->Logo = $data->Logo; $model->Slogan = $data->Slogan; $model->owner_id = $data->owner_id; $model->shop_type = $data->shop_type; $model->status = $data->status; if ($model->save()) { $response["status"] = 'success'; $response["message"] = 'Shop updated successfully.'; $response["data"] = (int) $model->owner_id; http_response_code(200); header('Content-type: application/json'); echo json_encode($response, JSON_NUMERIC_CHECK); } else { $response["status"] = 'error'; $response["message"] = ''; $response["error"] = $model->getErrors(); header('Content-type: application/json'); echo json_encode($response, JSON_NUMERIC_CHECK); } }
public function actionDetails($OwnerId) { $model = Shopowner::findOne($OwnerId); $shopmodel = Shop::find()->where(['owner_id' => $OwnerId])->all(); //$connection = \Yii::$app->db; //echo $model->name; //exit; return $this->render('details', ['model' => $model, 'shopmodel' => $shopmodel]); }