/** * Find the Protocol or App Abort 404. */ public function findProtocol(Route $route) { $this->protocol = Protocol::findOrFail($route->getParameter('protocols')); }
public function stats($id) { $protocol = Protocol::findOrFail($id); $users = User::with(array('examScores' => function ($query) use($protocol) { $query->whereSurveyId($protocol->survey_id); }))->canStudyProtocol($protocol->id)->get(); return view()->make('dashboard.pages.protocol.exams', compact('protocol', 'users')); }