Ejemplo n.º 1
0
 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;
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $dependency = Dependency::findOrFail($id);
     $dependency->delete();
     flash()->success('Success', "Dependency deleted successfully");
     return redirect()->back();
 }