title: Laravel how to get current Time and Date value
body: <p>I`m developing an Attendance Management system.so that my supervisor ask me to develop following view to get attendance time and date value.</p>
  
  <p><a href="https://i.stack.imgur.com/dKhwL.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dKhwL.jpg" alt="enter image description here"></a>
  Few requirements i need.</p>
  
  <ol>
  <li><p>All the records need to be saved in the database based on Trainee Id.according to that view if one having above ID check the box and then press the mark button that time value and Trainee id must be saved in the database as on time.</p></li>
  <li><p>Then if once mark it Date value also need to be saved in the database.</p></li>
  <li>Then again check it and press the mark button it must go their as Off time.only 2 records need to be allowed otherwise their can be many on off values.</li>
  </ol>
  
  <p>can anyone suggest me the relevant controller function for that?</p>
  
  <p>here is the relevant above view </p>
  
  <pre><code>&lt;table class="table table-striped"&gt;
        &lt;thead&gt;
  
         &lt;th&gt;Trainee ID&lt;/th&gt;
          &lt;th&gt;Name with Initials&lt;/th&gt; 
          &lt;th&gt;Time&lt;/th&gt;
          &lt;th&gt;Mark Here!&lt;/th&gt;
        &lt;/thead&gt;
  
        &lt;tbody&gt;
          @foreach($items as $item)
  
      &lt;tr&gt;
  
       &lt;td&gt;{{ $item-&gt;trainee_id }}&lt;/td&gt;
        &lt;td&gt;{{ $item-&gt;name_with_initials }}&lt;/td&gt;
  
  
          &lt;td&gt;
          &lt;label&gt;&lt;input type="checkbox" value=""&gt;&amp;nbsp; Time&lt;/label&gt;
        &lt;/td&gt;
  
          &lt;td&gt;
          &lt;a class="btn btn-info" href="Bankdetails/{{ $item-&gt;trainee_id }}"&gt;Mark Here&lt;/a&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
          @endforeach
  
        &lt;/tbody&gt;
  
  &lt;/table&gt;
  </code></pre>