title: how to add data from Employee table to user table in YII2 advanced
body: <p>I am working on my collage project i.e. Employee Management. I have Employee table in sql(crud is also generated from gii). only Admin is having rights to create Employee (there is no Signup).</p>
  
  <p>My Problem: when I am creating employee then I am not able to save data in user table also, please help me to save data in both Employee and user table.</p>
  
  <p>Thanks in advance</p>
  
  <p>Update:</p>
  
  <p>Below is the code:</p>
  
  <pre><code>public function actionCreate() { 
   $model1=new Employee; 
   $model2=new User; 
   if(isset($_POST['Employee']) &amp;&amp; isset($_POST['User']))
   { 
     $model1-&gt;attributes=$_POST['Emoloyee']; 
     $model2-&gt;attributes=$_POST['User']; 
     $model1-&gt;save(); 
     $model2-&gt;save(); 
     echo 'data is saved in both tables'; 
   } 
   $this-&gt;render('create',array('model1'=&gt;$model1,model2'=&gt;$mod‌​‌​el2)); 
  }
  </code></pre>