dashboard komoditas
This commit is contained in:
@@ -57,6 +57,7 @@ class SurveyPetaniController extends Controller
|
||||
->leftJoin("{$komoditasTable} as k", 'k.id', '=', 'p.komoditas_id')
|
||||
->selectRaw("COALESCE(k.nama, 'Belum ditentukan') as nama")
|
||||
->selectRaw('COUNT(p.id) as petani_count')
|
||||
->where('k.is_utama', true)
|
||||
->groupBy('k.id', 'k.nama')
|
||||
->orderByDesc('petani_count')
|
||||
->get();
|
||||
@@ -155,6 +156,7 @@ class SurveyPetaniController extends Controller
|
||||
->leftJoin("{$komoditasTable} as k", 'k.id', '=', 'p.komoditas_id')
|
||||
->selectRaw("COALESCE(k.nama, 'Belum ditentukan') as label")
|
||||
->selectRaw('COALESCE(SUM(l.jumlah_tanaman), 0) as total')
|
||||
->where('k.is_utama', true)
|
||||
->groupBy('k.id', 'k.nama')
|
||||
->orderByDesc('total')
|
||||
->get();
|
||||
|
||||
Reference in New Issue
Block a user