Save received JSON information into database
<p>I have a client in angular that sends to my server side in YII2 a JSON with all information about a quote.
This is the JSON received in the server side.</p>

<pre><code>{  
   "client1":{  
      "id":"1",
      "selectedItem":{  
         "id":2,
         "software":"TV",
         "price":14850,
         "configuration":1,
         "workflow":1.5
      },
      "quantity":1,
      "locations":22,
      "notes":"hello",
      "cost":13500,
      "labor":"1.63",
      "workflow":1.5,
      "custom":0,
      "learning":35,
      "price":13500,
      "configuration":1
   },
   "client2":{  
      "id":"2",
      "selectedItem":{  
         "id":5,
         "software":"DVD",
         "price":2500,
         "configuration":0.5,
         "workflow":1.5
      },
      "quantity":2,
      "locations":136,
      "notes":"its me",
      "cost":5000,
      "labor":0,
      "workflow":1.5,
      "custom":0,
      "$$hashKey":"object:5",
      "price":2500,
      "configuration":0.5
   },
   "live":"11",
   "training":"1",
   "staffTraining":"4"
}
</code></pre>

<p>Its needed to create a record in the database but don't know how to access the products information can only access to <code>live</code>, <code>training</code> and <code>staffTraining</code> keys.</p>

<p>This is the tables I want to insert the record</p>

<p><img src="https://puu.sh/mUcoN/c29eae322e.png" alt="Database Diagram"></p>

<p>Server code to add quote</p>

<pre><code>public function actionCreate() {
    $model = new Quote();
    Yii::$app-&gt;response-&gt;format = Response::FORMAT_JSON;

    if ($data=Yii::$app-&gt;request-&gt;post() ) {
        $model-&gt;attributes = $data;
        if($model-&gt;save()) {
            echo(json_encode("success"));
        } else {
            echo json_encode($model-&gt;errors);
        }
    } 
}
</code></pre>