samedi 21 mars 2020

How to i get gaji from table gaji when i choose grade

How to i get gaji from table gaji when i choose grade

if I choose grade A, the salary will be 1000000 automatically

Pegawai.blade.php

@php

$A = DB::table('karyawan')->join('gaji','gaji.id', '=', 'karyawan.gaji_id')->->get('gaji.gaji');
$B = DB::table('karyawan')->join('gaji','gaji.id', '=', 'karyawan.gaji_id')->->get('gaji.gaji');
$C = DB::table('karyawan')->join('gaji','gaji.id', '=', 'karyawan.gaji_id')->->get('gaji.gaji');
$D = DB::table('karyawan')->join('gaji','gaji.id', '=', 'karyawan.gaji_id')->->get('gaji.gaji');

@endphp
                  <tbody>
                    @foreach($ar_karyawan as $peg)
                    <tr>
                        <td></td>
                      <td></td>
                        <td></td>
                      <td></td>
                      <td></td>
                      <td></td>
                      <td></td>
                    </tr>
                    @endforeach
                  </tbody>
                </table>

PegawaiController.php

 public function index()
    {
         $ar_karyawan = DB::table('karyawan')
            ->join('gaji', 'gaji.id', '=', 'karyawan.gaji_id')
            ->select('karyawan.*', 'gaji.gaji AS gaji')
            ->get();
         return view('pegawai.index', compact('ar_karyawan'));

    }


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

Aucun commentaire:

Enregistrer un commentaire