You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
2.4 KiB
60 lines
2.4 KiB
<?php |
|
|
|
namespace App\Http\Controllers; |
|
|
|
use App\Models\{ |
|
User, |
|
Project, |
|
VersionGantt, |
|
ProjectIssues, |
|
ProjectRisks |
|
}; |
|
class ProjectCarausellController extends Controller |
|
{ |
|
public function invoke() { |
|
// Master Data |
|
$projectData = Project::query() |
|
->select("id","nama","kode_sortname","pm_id","budget_health","calculation_status","mulai_proyek","akhir_proyek","rencana_biaya","company","scurve") |
|
->get(); |
|
|
|
$arr = []; |
|
foreach($projectData as $project) { |
|
$projectRisk = ProjectRisks::query() |
|
->select('proyek_id','description','level_risk','preventive_risk') |
|
->where('proyek_id', $project['id']) |
|
->get() |
|
->toArray(); |
|
$projectIssue = ProjectIssues::query() |
|
->select('proyek_id','description','level_issue') |
|
->where('proyek_id',$project['id']) |
|
->get() |
|
->toArray(); |
|
$ganttData = VersionGantt::query() |
|
->select('id', 'name_version','hierarchy_ftth_id','cost_to_complete','proyek_id','calculation_type') |
|
->where('proyek_id',$project['id']) |
|
->orderByDesc('id') |
|
->first(); |
|
$projectManager = User::where('id', $project['pm_id'])->value('name'); |
|
$arr[]= [ |
|
"project" => [ |
|
"id" => $project['id'], |
|
"pm_id" => $project['pm_id'], |
|
"nama" => $project['nama'], |
|
"kode_sortname" => $project['kode_sortname'], |
|
"budget_health" => $project['budget_health'], |
|
"calculation_status" => $project['calculation_status'], |
|
"mulai_proyek" => $project['mulai_proyek'], |
|
"akhir_proyek" => $project['akhir_proyek'], |
|
"rencana_biaya" => $project['rencana_biaya'], |
|
"company" => $project['company'], |
|
"scurve" => $project['scurve'], |
|
], |
|
"project_manager" => $projectManager, |
|
"project_risk" => $projectRisk, |
|
"project_issue" => $projectIssue, |
|
"gantt"=> $ganttData |
|
]; |
|
} |
|
return response()->json(['status'=>'success','code'=> 200,'data'=> $arr, "total_project"=>count($arr)], 200); |
|
} |
|
}
|
|
|