samedi 26 septembre 2020

How to use old() helper in input fields of Laravel blade

In my Laravel-5.8 project I am working on a leave application that will iterate with employee_type. The fields in the view blade are array elements. The code is as shown below:

@foreach ($employeetypes as $key=> $employeetype)
<tr>
  <td width="5%">
    
  </td>                             
  <td width="30%">  
    <span></span> 
  </td>
  <td width="20%"><input type="number" name="no_of_days[]" placeholder="Enter leave days here" class="form-control no_of_days" max="120">
  </td>
  <td width="15%">                    
  <select class="form-control select2bs4" data-placeholder="Select Applicable Gender" tabindex="1" name="leave_applicable_gender[]">
   <option value="0" selected="true" disabled="true">Select Applicable Gender</option>                                                          
      @foreach(AppHelper::LEAVE_APPLICABLE_GENDER as $key1 => $value)
   <option value="" >
       
    </option>
      @endforeach                                       
   </select>                                 
   </td>                                                                  
  <td width="10%"><input type="checkbox" name="weekend_inclusive"  class="form-control" unchecked data-bootstrap-switch data-off-color="danger" data-on-color="success" data-off-text="NO" data-on-text="YES">
   </td>
 @endforeach

Everything submits to the database successfully. Since all are array fields, how do I add old() helper to each of the input fields (number, dropdown and checkbox)?

Thank you



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/36bN8QX
via IFTTT

Aucun commentaire:

Enregistrer un commentaire