Wednesday, March 8, 2017

Join Table Error Undefined property

Hello i want to ask you guys about my problem, please kindly help me...

First, I've two table 'Keluhans' and 'Tindakans' then i want to show 'produk, username, masalah' from tb keluhans + 'perbaikan_sementara, and target_verifikasi' from tb tindakans

This is my code, idk why the result is Undefined property: stdClass::$id in View

My Controller Function

public function lihattindaklanjut(){
    $halaman = "tindaklayanan";
    $keluhan_list=DB::table('keluhans')
    ->select(DB::raw('id,produk,username,masalah'))
    ->where('status','=','Proses')->get();

    $rows = DB::table('tindakans')
    ->join('keluhans','keluhans.id','=','tindakans.id_keluhan')
    ->select(DB::raw('produk', 'username', 'masalah','perbaikan_sementara', 'target_verifikasi', 'keluhans.id'))->get();

    return view('layanankonsumen.lihattindaklanjut',compact('halaman','keluhan_list','rows'));
}

My View

<h4>Daftar Tindakan yang Dilakukan</h4><hr>
    <br><br>  
    <hr>
    @if (!empty($rows))
      <table class="striped bordered">
        <thead>
            <tr>
              <th hidden="true">id</th>
              <th>Produk</th>                                 
              <th>Pelanggan</th>
              <th>Masalah</th>
              <th>Perbaikan Sementara</th>
              <th>Target Verifikasi</th>                                       
            @if (Auth::check() && (Auth::user()->level == 'MR' || Auth::user()->level == 'PDD'))
              <th colspan="4" style="text-align:center;">Action</th>
            @endif
          </tr>
        </thead>
        <tbody>                        
          <?php foreach($rows as $value): ?>
            <tr>
              <td hidden="true"></td>
              <td></td>                                 
              <td></td>
              <td></td>
              <td></td>
              <td></td>
              <td>
              @if (Auth::check() && (Auth::user()->level == 'MR' || Auth::user()->level == 'PDD'))
                <td><a href="" class="btn">Detail</a>
                <td><a href="" class="btn">Edit</a>
                <td><a href="" class="btn">Delete</a>
              @endif
              </td>                                
              </td>
            </tr>
          <?php endforeach?>
        </tbody>
    </table>
  @else
    <h5>Tidak ada data Tindakan</h5>
  @endif
</div>



via Christianus Andre

Advertisement