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'));

    }


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire