예제 #1
0
 public function Programs()
 {
     $userid = $this->id;
     return Program::whereHas('Members', function ($q) use($userid) {
         $q->where('user_id', $userid);
     })->get();
 }
예제 #2
0
 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'));
 }