public function dashboard($userid)
 {
     $user = User::findOrFail($userid);
     //get programs, workstreams and projects that the user is a member of
     $programs = Program::whereHas('Members', function ($q) use($userid) {
         $q->where('user_id', $userid);
     })->get();
     $workstreams = WorkStream::whereHas('Members', function ($q) use($userid) {
         $q->where('user_id', $userid);
     })->get();
     $projects = Project::whereHas('Members', function ($q) use($userid) {
         $q->where('user_id', $userid);
     })->get();
     //get tasks for the user
     $tasks = Task::where('action_owner', $userid)->get();
     //Get the users actions
     $actions = Action::where('actionee', $userid)->get();
     //Get risks and issues assigned to the user
     $risks = Risk::where('owner', $userid)->orWhere('action_owner', $userid)->get();
     //return $risks;
     return view('Users.dashboard', compact('user', 'programs', 'workstreams', 'projects', 'tasks', 'risks', 'actions'));
 }
Example #2
0
 public function Projects()
 {
     $userid = $this->id;
     return Project::whereHas('Members', function ($q) use($userid) {
         $q->where('user_id', $userid);
     })->get();
 }