Browse Source

Project to k3 checklist adding name

pull/3/head
Wahyu Ramadhan 2 years ago
parent
commit
47b4f779bf
  1. 7
      app/Http/Controllers/ProjectToChecklistK3Controller.php

7
app/Http/Controllers/ProjectToChecklistK3Controller.php

@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\ProjectToChecklistK3;
use App\Models\ChecklistK3;
class ProjectToChecklistK3Controller extends Controller
{
@ -122,6 +123,12 @@ class ProjectToChecklistK3Controller extends Controller
$builder = $dataBuilder['builder'];
$countBuilder = $dataBuilder['count'];
$dataGet = $builder->get();
foreach($dataGet as $key => $value) {
$checklist = ChecklistK3::where('id', $value->checklist_k3_id)->first();
$dataGet[$key]->checklist_k3_name = $checklist->name;
}
$totalRecord = $countBuilder->count();
return response()->json(['status'=>'success','code'=>200,'data'=>$dataGet, 'totalRecord'=>$totalRecord], 200);
}

Loading…
Cancel
Save