Mysql
 sql >> Teknologi Basis Data >  >> RDS >> Mysql

Membuat kehadiran di laravel

Anda dapat mengubah tampilan menjadi berikut

<table class="table-responsive table-condensed table-striped table-hover table-bordered">
  <thead>
    <tr>
      <td>Salesman</td>
      <?php for($i = 1; $i <= $days_count; $i++){ ?>
      <td>
        <?php echo $i; ?>
      </td>
      <?php }?>
    </tr>
  </thead>
  <tbody>
    @forelse($final as $attend)
    <tr>
      <td>{{ $attend['name'] }}</td>
      <?php 
        for($i = 1; $i < $days_count; $i++){
          $make_date = date("Y-m")."-".$i;
          $set_attendance_for_day=false;
          $attendance_for_day ="-";
          foreach($attend['attendance'] as $att){
            if($att['date'] == $make_date){
               $attendance_for_day = "P";
            } 
          } 
      ?>
      <td>
        <?php echo $attendance_for_day; ?>
      </td>

      <?php }?>
    </tr>
    @empty
    <tr>
      <td>No Salesman</td>
    </tr>
    @endforelse
  </tbody>
</table>

** Pembaruan Berdasarkan komentar

<table class="table-responsive table-condensed table-striped table-hover table-bordered">
  <thead>
    <tr>
      <td>Salesman</td>
      <?php for($i = 1; $i <= $days_count; $i++){ ?>
      <td>
        <?php echo $i; ?>
      </td>
      <?php }?>
    </tr>
  </thead>
  <tbody>
    @forelse($final as $attend)
    <tr>
      <td>{{ $attend['name'] }}</td>
      <?php 
        for($i = 1; $i < $days_count; $i++){
          $make_date = date("Y-m")."-".$i;
          $set_attendance_for_day=false;
          $attendance_for_day ="-";
          foreach($attend['attendance'] as $att){
            if($att['date'] == $make_date){
               $attendance_for_day = "P";
            } 
          } 
      ?>
      <td>
        <?php echo $attendance_for_day; ?>
        <?php if($i==20){ ?>

          ---------------------------------------------------
          <PLACE YOUR FORM HERE>
          ---------------------------------------------------
        <?php } ?>
      </td>

      <?php }?>
    </tr>
    @empty
    <tr>
      <td>No Salesman</td>
    </tr>
    @endforelse
  </tbody>
</table>


  1. Database
  2.   
  3. Mysql
  4.   
  5. Oracle
  6.   
  7. Sqlserver
  8.   
  9. PostgreSQL
  10.   
  11. Access
  12.   
  13. SQLite
  14.   
  15. MariaDB
  1. MySQL Query untuk memilih data dari minggu lalu?

  2. MYSQL Masukkan id dari tabel lain

  3. Kesalahan sintaks prosedur tersimpan MySQL setelah BEGIN

  4. Teks bahasa Bengali tidak ditampilkan dalam file CSV Unicode

  5. DataTable dengan Ajax tidak berfungsi dengan baik setelah menggunakan serverSide:true