Browse Source

update filter project by company

pull/1/head
farhantock 1 year ago
parent
commit
67da512ce7
  1. 22
      app/Http/Controllers/ProjectCarausellController.php
  2. 2
      routes/web.php

22
app/Http/Controllers/ProjectCarausellController.php

@ -2,6 +2,7 @@
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\{
User,
Project,
@ -9,13 +10,26 @@ use App\Models\{
ProjectIssues,
ProjectRisks
};
class ProjectCarausellController extends Controller
{
public function invoke() {
public function invoke(Request $request)
{
// 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();
$company_id = $request->route('company_id');
$all_project = $request->route('all_project');
$hierarchy = $request->route('hierarchy');
$query = Project::query()
->select("id", "nama", "kode_sortname", "pm_id", "budget_health", "calculation_status", "mulai_proyek", "akhir_proyek", "rencana_biaya", "company", "scurve");
if ($all_project) {
$query->where('company_id', $company_id);
} else {
$query->where('created_by_id', $hierarchy);
}
$projectData = $query->get();
$arr = [];
foreach ($projectData as $project) {

2
routes/web.php

@ -81,7 +81,7 @@ $router->group(['prefix' => 'api', 'middleware' => 'cors'], function () use ($ro
/* $router->get('/project/get-status-health-schedule/{id}', 'ProjectController@getStatusSchedule'); */
/* $router->get('/project/get-status-health-budget/{id}', 'ProjectController@getStatusBudget'); */
$router->get('/project-carausell', 'ProjectCarausellController@invoke');
$router->get('/project-carausell/{company_id}/{all_project}/{hierarchy}', 'ProjectCarausellController@invoke');
$router->post('/project-charter/search', 'ProjectCharterController@search');
$router->post('/project-charter/add', 'ProjectCharterController@add');

Loading…
Cancel
Save