Fix senarai next lelongan at pembida side

This commit is contained in:
Amir
2023-05-14 14:24:43 +08:00
parent 0581ed7d31
commit 0a08a4bcd6
@@ -1075,9 +1075,9 @@ class LelongMobileController extends Controller
$currentdate = Carbon::now(); $currentdate = Carbon::now();
$currentdate = $currentdate->toDateString(); $currentdate = $currentdate->toDateString();
$lelong = Lelong::join('cawangan_lelong', 'lelong.id', '=', 'cawangan_lelong.lelong_id') $lelongs = Lelong::join('cawangan_lelong', 'lelong.id', '=', 'cawangan_lelong.lelong_id')
->join('cawangan', 'cawangan_lelong.caw_id', '=', 'cawangan.id') ->join('cawangan', 'cawangan_lelong.caw_id', '=', 'cawangan.id')
->where('tarikh_lelong', '>', $currentdate) ->where('tarikh_lelong', '>', $currentdate)
->select( ->select(
'lelong.id as lelong_id', 'lelong.id as lelong_id',
'lelong.tarikh_lelong', 'lelong.tarikh_lelong',
@@ -1086,9 +1086,19 @@ class LelongMobileController extends Controller
'lelong.masamula_lelong', 'lelong.masamula_lelong',
'lelong.masatamat_lelong', 'lelong.masatamat_lelong',
) )
->groupBy('cawangan.caw_name')
->orderBy('lelong.tarikh_lelong', 'ASC') ->orderBy('lelong.tarikh_lelong', 'ASC')
->get()->toArray(); ->get();
$lelongs = $lelongs->groupBy('tarikh_lelong');
$lelong = collect();
foreach ($lelongs as $index => $lel) {
$unique_caw = $lel->unique('caw_id');
foreach ($unique_caw as $lel_caw) {
$lelong->add($lel_caw);
}
}
foreach($lelong as $index => $data) foreach($lelong as $index => $data)
{ {