/**
  * Creates a new LocationHistory model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new LocationHistory();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
 /**
  * Creates a new LocationHistory model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     Yii::$app->response->format = 'json';
     $model = new LocationHistory();
     $arr['LocationHistory'] = Yii::$app->request->post();
     if ($model->load($arr)) {
         $model->package_id = $arr['LocationHistory']['package_id'];
         Yii::$app->response->setStatusCode(201);
         if ($model->save()) {
             return $model;
         }
     } else {
         Yii::$app->response->format = 'json';
         Yii::$app->response->setStatusCode(400);
         return ['message' => 'Record cound\'t be saved'];
     }
 }