/** * Execute the job. * * @return void */ public function handle() { //if( ($user->notifyDueTasks) || ($user->notifyDueActions) || ($user->notifyDueRisks) ) $totalcount = 0; //$messages = array(); $actions = null; $risks = null; //check if user wants action emails if ($this->user->notifyDueActions) { //compile list of action that are overdue $actions = Action::where('actionee', $this->user->id)->DueActions()->get(); $totalcount += $actions->count(); //$messages['actions'] = $actions->toArray(); } //check if user wants risk emails if ($this->user->notifyDueRisks) { //compile list of risks that are overdue $risks = Risk::where('owner', $this->user->id)->DueReview()->get(); $totalcount += $risks->count(); //$messages['risks'] = $risks->toArray(); } //if there is something due review send it if ($totalcount > 0) { appMailer::emailUserDueNotfications($this->user, $actions, $risks); } }
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')); }
public function OverdueActionCount() { return Action::where('actionee', $this->id)->where('status', 'Open')->where('DueDate', '<', date("Y-m-d H:i:s"))->count(); }