I want to make data based on 2 groups. namely the month group in that year and the group id then calculated based on the existing product id of the product in
I tried this code
$tahunx = '2021';
$barangmasuk=BarangMasuk::groupBy('id_barang','months')->select([
'barang_masuk.id_barang',
DB::raw("DATE_FORMAT(tgl_masuk,'%M %Y') as months", '=',$tahunx),
DB::raw('sum(jml_bm) as jumlah')
])->get();
dd($barangmasuk);
I want to create data that looks like this
there is table 1 and table 2 that I use
Please help
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire