Browse Source

show image report in detail (multiple)

pull/3/head
ardhi 2 years ago
parent
commit
47cdf72e47
  1. 20
      app/Http/Controllers/ReportK3Controller.php

20
app/Http/Controllers/ReportK3Controller.php

@ -110,12 +110,20 @@ class ReportK3Controller extends Controller
$resultData = DB::table($dataChild['table_name'])->where($columnSelf,$value->{$columnForeign})->get();
$value->childData = $resultData;
$value->k3_checked = $resultData->pluck("name_checklist_k3")->all();
$dataImage = Image::where("category", "report_k3")->where("ref_id", $value->id)->first();
if($dataImage){
$value->image = $dataImage->image;
}else{
$value->image = null;
}
// $dataImage = Image::where("category", "report_k3")->where("ref_id", $value->id)->first();
// if($dataImage){
// $value->image = $dataImage->image;
// }else{
// $value->image = null;
// }
$dataImage = Image::where("category", "report_k3")->where("ref_id", $value->id)->get();
$images = [];
if (count($dataImage) > 0) {
foreach($dataImage as $reportImage) {
array_push($images, $reportImage);
}
}
$value->image = $images;
$idsChecklist = $resultData->pluck("checklist_k3_id")->all();
$CheklistK3Ids = ProjectToChecklistK3::whereNotIn("checklist_k3_id", $idsChecklist)->where("proyek_id", $value->proyek_id)->pluck("checklist_k3_id");
$value->k3_not_checked = ChecklistK3::whereIn("id", $CheklistK3Ids)->pluck("name")->all();

Loading…
Cancel
Save