public function view($id) { $projects = Project::find($id); $as_pengelola = 0; $undisplayRoleClient = ""; // Find Auth Pengelola Project if (Auth::user()->userRoles->role == 7) { foreach ($projects->po as $po) { if ($po->status == '1') { foreach ($po->get_users as $gem) { foreach ($gem->users as $pengelola) { if ($pengelola->id == Auth::user()->id) { $as_pengelola = 1; } } } } } foreach ($projects->member_admin as $adm) { if ($adm->status == '1') { foreach ($adm->get_users as $gem) { foreach ($gem->users as $pengelola) { if ($pengelola->id == Auth::user()->id) { $as_pengelola = 1; } } } } } if ($as_pengelola == 0) { Alert::error('Anda tidak dapat mengelola atau melihat project ini'); return redirect('dashboard'); } } // Find Auth Client if (Auth::user()->userRoles->role == 11) { $undisplayRoleClient = "undisplayRole"; $auth = 0; foreach ($projects->acc as $acc) { if ($acc->id_projects == $projects->id) { $auth = 1; } else { $auth = 0; } } if ($auth == 0) { Alert::error('Anda tidak dapat akses project ini'); return redirect('dashboard'); } } $member_cats = MemberCat::where('status', 1)->get(); $data = Employee::all(); $link_dis = "link-disable"; if ($projects->status == 0 || $projects->status == 1) { $link_dis = ""; } $teamDB = Team::where('id_projects', $id)->where('status', 1)->get(); $teamCount = count($teamDB); $sumStore = 0; $sumAStore = 0; $sum = 0; foreach ($projects->store as $store) { $sumStore++; } foreach ($teamDB as $team) { foreach ($team->store as $gs) { $sumAStore++; foreach ($gs->members as $gm) { if ($gm->status == 1) { $sum++; } else { } } } } $totalMem = $sum; $totalStore = $sumStore; $totalAStore = $sumAStore; return view('dropmin/project/view')->with('project', $projects)->with('member_cats', $member_cats)->with('link_dis', $link_dis)->with('teamCount', $teamCount)->with('undisplayRoleClient', $undisplayRoleClient)->with('totalStore', $totalStore)->with('as_peng', $as_pengelola)->with('totalAStore', $totalAStore)->with('totalMem', $totalMem)->with('datas', $data); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function view($id) { $projects = Project::find($id); $member_cats = MemberCat::where('status', 1)->get(); $data = Employee::all(); $link_dis = "link-disable"; if ($projects->status == 0 || $projects->status == 1) { $link_dis = ""; } $teamDB = Team::where('id_projects', $id)->where('status', 1)->get(); $teamCount = count($teamDB); $sumStore = 0; $sumAStore = 0; $sum = 0; foreach ($projects->store as $store) { $sumStore++; } foreach ($teamDB as $team) { foreach ($team->store as $gs) { $sumAStore++; foreach ($gs->members as $gm) { if ($gm->status == 1) { $sum++; } else { } } } } $totalMem = $sum; $totalStore = $sumStore; $totalAStore = $sumAStore; return view('dropmin/project/view')->with('project', $projects)->with('member_cats', $member_cats)->with('link_dis', $link_dis)->with('teamCount', $teamCount)->with('totalStore', $totalStore)->with('totalAStore', $totalAStore)->with('totalMem', $totalMem)->with('datas', $data); }