title: how to store n number of employee attendance data a ta time with their id in another table as any other column name
body: <p><a href="https://i.stack.imgur.com/ieMio.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ieMio.png" alt="enter image description here"></a></p>
  
  <p>Model 1
  
  
  <p>namespace App;</p>
  
  <p>use Illuminate\Database\Eloquent\Model;</p>
  
  <p>class employee_attendence extends Model
  {
      //</p>
  
  <pre><code>protected $fillable  = array('is_present' ,'date' );
  //protected $fillable=[];
  public $timemstamps= false ;
  
  public function employee_data(){
          //return $this-&gt;hasOne(employee_data::class,'App/employee_data');
      return $this-&gt;hasOne('App\employee_data');
  
  }
  </code></pre>
  
  <p>}
  model 2
  
  
  <p>namespace App;</p>
  
  <p>use Illuminate\Database\Eloquent\Model;</p>
  
  <p>class employee_data extends Model
  {
      //protected $fillabel=['first_name','last_name','contact_no','date_joining','post'];</p>
  
  <pre><code>protected $fillable  = array('first_name', 'last_name', 'contact_no' ,'date_joining','post' );
  //protected $fillable=[];
  public $timemstamps= false ;
  
  public function employee_attendence()
  {
          //return $this-&gt;hasOne( employee_attendence::class, 'App/employee_attendence');
          return $this-&gt;belongsTo('App\employee_attendence');
  }
  </code></pre>
  
  <p>}</p>
  
  <p>controller</p>
  
  <pre><code>public function Attendence() 
  {
      $data=employee_data::all();
      return view('attendence',compact('data'));
  }   
  
  public function mark_attendence(Request $request)
  {
  
      $request-&gt;validate([
      'date'  =&gt;  'required',
      'is_present'  =&gt;  'required'
  
      ]);
  
      $employee = new employee_attendence([
      'is_present' =&gt; $request-&gt;get('is_present'),
      'date' =&gt; $request-&gt;get('date')
  
      ]);
  
  
  $employee-&gt;save();
  $employee-&gt;employee_data()-&gt;create([]);
  
  return redirect('/index')-&gt;with('succ','Attendence Added Successfully');
  
  
  }
  </code></pre>
  
  <p>form 
  </p>
  
  <pre><code>&lt;table class="table table-bordered  "&gt;
      &lt;tr&gt;
          &lt;th width="5%"&gt;Id&lt;/th&gt;
          &lt;th width="15%"&gt;First Name&lt;/th&gt;
          &lt;th width="15%"&gt;Last Name&lt;/th&gt;
          &lt;th width="15%"&gt;DateOfJoining&lt;/th&gt;
          &lt;th width="10%"&gt;post&lt;/th&gt;
          &lt;th width="15%"&gt;Date&lt;/th&gt;
          &lt;th width="10%"&gt;Remark&lt;/th&gt;
          &lt;th width="30%"&gt;Action&lt;/th&gt;
      &lt;/tr&gt;
      @foreach( $data as $row )
          &lt;tr&gt;
              &lt;td&gt;{{ $row-&gt;id }}&lt;/td&gt;
              &lt;td&gt;{{ $row-&gt;first_name }}&lt;/td&gt;
              &lt;td&gt;{{ $row-&gt;last_name }}&lt;/td&gt;
              &lt;td&gt;{{ $row-&gt;date_joining }}&lt;/td&gt;
              &lt;td&gt;{{ $row-&gt;post }}&lt;/td&gt;
              &lt;td&gt;&lt;input type="date" value="CURDATE()" name="date"  &gt;&lt;/td&gt;
              &lt;td&gt;
                  &lt;label class="form-check-label" for="radio2"&gt;
                      &lt;input type="checkbox" class="form-check-input" id="Present" name="is_present" value="Present"&gt;&amp;nbsp &amp;nbsp Present 
                  &lt;/label&gt;&lt;br&gt;
  
                  &lt;label class="form-check-label" for="radio2"&gt;
                       &lt;input type="checkbox" class="form-check-input" id="Absent" name="is_present" value="Absent"&gt;&amp;nbsp &amp;nbsp Absent
                  &lt;/label&gt;&lt;/td&gt;
  
  
              &lt;td&gt;
  
              &lt;button type="Submit" class="btn btn-primary"&gt;&lt;span class="glyphicon glyphicon-ok"&gt;&lt;/span&gt;&lt;/button&gt;
  
  
              &lt;/td&gt;
          &lt;/tr&gt;
      @endforeach
  </code></pre>
  
  <p>store id from table 1 as user_id in table2</p>