public function showSpecificCollege() { $collegeIDInput = Input::get('college-dropdown'); $college = College::find($collegeIDInput); $collegedepartments = $college->departments()->whereHas('programs', function ($q) { $q->whereNotIn('programid', array(62, 66, 38)); $q->where('degreelevel', 'U'); })->get(); //ave students per year and ave difference $programids = $college->programs()->whereNotIn('programid', array(62, 66, 38))->where('degreelevel', 'U')->lists('programid'); //To get batches of program whithin 2000-2009 $yearsArray = Studentterm::whereIn('programid', $programids)->where('year', '>', 1999)->where('year', '<', 2014)->groupBy('year')->orderBy('year', 'asc')->lists('year'); $yearlyStudentAverage = []; $collegeDepartmentsAverage = []; foreach ($yearsArray as $yearData) { $aveStudents = round($college->getYearlyAveStudents($yearData), 2); if ($aveStudents > 1) { $yearlyStudentAverage[$yearData] = $aveStudents; } } foreach ($collegedepartments as $collegedepartment) { $collegeDepartmentsAverage[$collegedepartment->unitname] = round($collegedepartment->getAveStudents(), 2); } $aveAttrition = $college->getAveAttrition(); $aveShiftRate = $college->getAveShiftRate(); $aveYearsBeforeDropout = $college->getAveYearsBeforeDropout(); $aveYearsBeforeShifting = $college->getAveYearsBeforeShifting(); $batchAttrition = $college->getBatchAttrition(); $departmentsAttrition = $college->getDepartmentsAveBatchAttrition(); $gradeCount = $college->getGradeCount(); $shiftGradeCount = $college->getShiftGradeCount(); $stbracketCount = $college->getSTBracketCount(); $shiftBracketCount = $college->getShiftSTBracketCount(); return View::make('college.college-specific', ['college' => $college, 'yearlyStudentAverage' => $yearlyStudentAverage, 'collegedepartments' => $collegedepartments, 'collegeDepartmentsAverage' => $collegeDepartmentsAverage, 'aveAttrition' => $aveAttrition, 'batchAttrition' => $batchAttrition, 'aveShiftRate' => $aveShiftRate, 'aveYearsBeforeDropout' => $aveYearsBeforeDropout, 'aveYearsBeforeShifting' => $aveYearsBeforeShifting, 'departmentsAttrition' => $departmentsAttrition, 'gradeCount' => $gradeCount, 'shiftGradeCount' => $shiftGradeCount, 'stbracketCount' => $stbracketCount, 'shiftBracketCount' => $shiftBracketCount]); }