/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { $chart = Chart::where('project_id', $id)->first(); $project = Project::find($id); $support_team_members = SupportTeamMember::where('project_id', $id)->get(); $technical_project_team_members = TechnicalProjectTeamMember::where('project_id', $id)->get(); $business_project_team_members = BusinessProjectTeamMember::where('project_id', $id)->get(); return view('charts.show', compact('chart', 'project', 'support_team_members', 'technical_project_team_members', 'business_project_team_members')); }
public function generate() { ini_set("max_execution_time", 0); if (Auth::user()->role == "Project Manager") { $activities = Activity::whereIn('action', array('Created', 'Deleted', 'Updated'))->where(function ($query) { return $query->where('action', '!=', 'Created')->orWhere('type', '!=', 'Deliverable'); })->where('user_id', Auth::user()->id)->get(); $projects = Project::where('user_id', Auth::user()->id)->get(); $projectids = array_pluck($projects, 'id'); $milestones = Milestone::whereIn('project_id', $projectids)->get(); $accomplishments = Accomplishment::whereIn('project_id', $projectids)->get(); $issues = Issue::whereIn('project_id', $projectids)->get(); $risks = Risk::whereIn('project_id', $projectids)->get(); $expenses = Expense::whereIn('project_id', $projectids)->get(); $actions = Action::whereIn('project_id', $projectids)->get(); $deliverables = Deliverable::whereIn('project_id', $projectids)->get(); $business_project_team_members = BusinessProjectTeamMember::whereIn('project_id', $projectids)->get(); $technical_project_team_members = TechnicalProjectTeamMember::whereIn('project_id', $projectids)->get(); $support_team_members = SupportTeamMember::whereIn('project_id', $projectids)->get(); return view('audit.generate', compact('activities', 'projects', 'milestones', 'accomplishments', 'issues', 'risks', 'expenses', 'actions', 'deliverables', 'business_project_team_members', 'technical_project_team_members', 'support_team_members')); } elseif (Auth::user()->role == "System Administrator") { $activities = Activity::whereIn('action', array('Created', 'Deleted', 'Updated'))->where(function ($query) { return $query->where('action', '!=', 'Created')->orWhere('type', '!=', 'Deliverable'); })->get(); $projects = Project::all(); $milestones = Milestone::all(); $accomplishments = Accomplishment::all(); $issues = Issue::all(); $risks = Risk::all(); $users = User::all(); $expenses = Expense::all(); $actions = Action::all(); $deliverables = Deliverable::all(); $business_project_team_members = BusinessProjectTeamMember::all(); $technical_project_team_members = TechnicalProjectTeamMember::all(); $support_team_members = SupportTeamMember::all(); return view('audit.generate', compact('activities', 'projects', 'milestones', 'accomplishments', 'issues', 'risks', 'users', 'expenses', 'actions', 'deliverables', 'business_project_team_members', 'technical_project_team_members', 'support_team_members')); } else { flash()->error('You are not authorized to proceed.'); return redirect()->action('ProjectsController@index'); } }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($project_id, $id) { $technical_project_team_member = TechnicalProjectTeamMember::find($id); $technical_project_team_member->delete(); flash()->success('Technical Project Team Member has been successfully deleted'); return redirect()->action('ChartsController@show', [$project_id]); }