public static function GetObject($subject_type, $subject_id) { switch ($subject_type) { case 'Program': return Program::findorFail($subject_id); break; case 'WorkStream': return WorkStream::findorFail($subject_id); break; case 'Project': return Project::findorFail($subject_id); break; case 'Risk': return Risk::findorFail($subject_id); break; case 'Task': return Task::findorFail($subject_id); break; case 'Action': return Action::findorFail($subject_id); break; case 'Rag': return rag::findorFail($subject_id); break; case 'Dependency': return Dependency::findorFail($subject_id); break; case 'ChangeRequest': return ChangeRequest::findorFail($subject_id); break; case 'Meeting': return Meeting::findorFail($subject_id); break; case 'Link': return Link::findorFail($subject_id); break; case 'Assumption': return Assumption::findorFail($subject_id); break; case 'Decision': return Decision::findorFail($subject_id); break; default: return null; } }
public function OverdueAssumptionCount() { return Assumption::where('owner', $this->id)->where('status', 'Open')->where('DueDate', '<', date("Y-m-d H:i:s"))->count(); }
public static function getSubjectName($subjecttype, $subjectid) { switch ($subjecttype) { case "Program": $program = Program::findOrFail($subjectid); return $program->name; break; case "WorkStream": $workstream = WorkStream::findOrFail($subjectid); return $workstream->name; break; case "Project": $project = Project::findOrFail($subjectid); return $project->name; break; case "Risk": $risk = Risk::findOrFail($subjectid); return $risk->title; break; case "Rag": $rag = rag::findOrFail($subjectid); return $rag->title; break; case "Task": $task = Task::findOrFail($subjectid); return $task->title; break; case "Dependency": $dependency = Dependency::findOrFail($subjectid); return $dependency->title; break; case "ChangeRequest": $changerequest = ChangeRequest::findOrFail($subjectid); return $changerequest->title; break; case "Meeting": $meeting = Meeting::findOrFail($subjectid); return $meeting->title; break; case "Action": $action = Action::findOrFail($subjectid); return $action->title; break; case "Link": $link = Link::findOrFail($subjectid); return $link->title; break; case "Assumption": $assumption = Assumption::findOrFail($subjectid); return $assumption->title; break; } }