/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { $subject = Program::where('id', $id)->with('RAGs', 'Risks', 'Members.User', 'Tasks.ActionOwner')->first(); if (!$subject) { abort(404, 'Program not found'); } //get worksteams for this program //todo : Move this to a seperate model to ensure single responsibility. Should add number of active projects to the workstream list. Maybe a nice small char $workstreams = WorkStream::where('program_id', $id)->orderBy('phase')->orderBy('status')->orderBy('name')->with('RAGs', 'Risks', 'Members.User')->get(); //return $program->Tasks; $subjecttype = 'Program'; $subjectid = $subject->id; return view('Program.show', compact('subject', 'workstreams', 'subjecttype', 'subjectid')); }