public function index() { $centers = ExamCenter::get(); $chosen_centers = ExamCenter::select('exam_centers.*')->join('student_exam_center AS sec', function ($join) { $join->on('sec.exam_center_id', '=', 'exam_centers.id')->where('sec.student_id', '=', student()->id)->where('sec.semester_id', '=', semester()->id); })->whereNull('sec.id')->get(); return $chosen_centers; return view('students::profile.exams.centers.index', compact('centers', 'chosen_centers')); }
/** * Register the service provider. * * @return void */ public function register() { //Exam Exam::created(function ($exam) { UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_exam', 'reference_id' => $exam->id]); }); Exam::updated(function ($exam) { UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_exam', 'reference_id' => $exam->id]); }); Exam::deleted(function ($exam) { UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_exam', 'reference_id' => $exam->id]); }); //ExamCenter ExamCenter::created(function ($center) { UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_center', 'reference_id' => $center->id]); }); ExamCenter::updated(function ($center) { UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_center', 'reference_id' => $center->id]); }); ExamCenter::deleted(function ($center) { UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_center', 'reference_id' => $center->id]); }); //ExamCenterPeriod ExamCenterPeriod::created(function ($period) { UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_period', 'reference_id' => $period->id]); }); ExamCenterPeriod::updated(function ($period) { UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_period', 'reference_id' => $period->id]); }); ExamCenterPeriod::deleted(function ($period) { UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_period', 'reference_id' => $period->id]); }); //ExamQuestion ExamQuestion::created(function ($question) { UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_question', 'reference_id' => $question->id]); }); ExamQuestion::updated(function ($question) { UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_question', 'reference_id' => $question->id]); }); ExamQuestion::deleted(function ($question) { UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_question', 'reference_id' => $question->id]); }); //ExamRecording ExamRecording::created(function ($recording) { UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_recording', 'reference_id' => $recording->id]); }); ExamRecording::updated(function ($recording) { UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_recording', 'reference_id' => $recording->id]); }); ExamRecording::deleted(function ($recording) { UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_recording', 'reference_id' => $recording->id]); }); //ExamResult ExamResult::created(function ($result) { UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_result', 'reference_id' => $result->id]); }); ExamResult::updated(function ($result) { UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_result', 'reference_id' => $result->id]); }); ExamResult::deleted(function ($result) { UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_result', 'reference_id' => $result->id]); }); //ExamResultAnswer ExamResultAnswer::created(function ($answer) { UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_answer', 'reference_id' => $answer->id]); }); ExamResultAnswer::updated(function ($answer) { UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_answer', 'reference_id' => $answer->id]); }); ExamResultAnswer::deleted(function ($answer) { UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_answer', 'reference_id' => $answer->id]); }); //ExamRules ExamRules::created(function ($rule) { UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_rule', 'reference_id' => $rule->id]); }); ExamRules::updated(function ($rule) { UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_rule', 'reference_id' => $rule->id]); }); ExamRules::deleted(function ($rule) { UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_rule', 'reference_id' => $rule->id]); }); //ExamExcuse ExamExcuse::created(function ($excuse) { UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_excuses', 'reference_id' => $excuse->id]); }); ExamExcuse::updated(function ($excuse) { UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_excuses', 'reference_id' => $excuse->id]); }); ExamExcuse::deleted(function ($excuse) { UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_excuses', 'reference_id' => $excuse->id]); }); }
public function report(Request $request) { # code... $per_page = request('per_page', 20); $students = $this->prepQuery($request->all()); $students = $students->paginate($per_page); $students->appends($request->except('page')); $year_term = Year::join('academystructure_terms', 'academystructure_years.id', '=', 'academystructure_terms.year_id')->select(\DB::raw('CONCAT(academystructure_years.name, "-", academystructure_terms.name) as name, academystructure_terms.id as tid'))->groupBy('academystructure_terms.name', 'academystructure_years.name')->orderBy('academystructure_terms.id')->pluck('name', 'tid')->toArray(); $spec_id = Specialty::pluck('name', 'id')->toArray(); $exam_center_id = ExamCenter::pluck('name', 'id')->toArray(); // return $students->pluck('sps'); return view('exams::centers.report', compact('students', 'year_term', 'spec_id', 'exam_center_id')); }