public function generate($id)
 {
     ini_set("max_execution_time", 0);
     $project = Project::find($id);
     $accomplishments = Accomplishment::where('project_id', $id)->get();
     $actions = Action::where('project_id', $id)->get();
     $expenses = Expense::where('project_id', $id)->get();
     $issues = Issue::where('project_id', $id)->get();
     $milestones = Milestone::where('project_id', $id)->get();
     $risks = Risk::where('project_id', $id)->get();
     $lastUser = $project->users->last();
     return view('projects.generate', compact('project', 'actions', 'accomplishments', 'expenses', 'issues', 'milestones', 'risks', 'lastUser'));
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($project_id, $id)
 {
     //
     $milestone = Milestone::find($id);
     $milestone->delete();
     flash()->success('Milestone has been successfully deleted!');
     return redirect()->action('ProjectsController@show', $project_id);
 }
Example #3
0
 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');
     }
 }
 public function postDelete(Request $request)
 {
     $event = \App\Milestone::find($request->id);
     $event->delete();
     \Session::flash('flash_message', 'Milestone deleted.');
     return redirect('/milestones');
 }
 protected function insertMilestone(Request $request, $id)
 {
     $milestone = Milestone::where('Project_FK', '=', $id)->first();
     if (!empty($milestone)) {
         $milestone->content = json_encode($request->input('content'));
         $milestone->save();
     } else {
         $milestone = new Milestone();
         $milestone->Project_FK = $id;
         $milestone->content = json_encode($request->input('content'));
         $milestone->save();
     }
 }