public function edit($announcement_id) { $announcement = Announcement::with('years', 'specialities', 'classrooms', 'students')->findOrFail($announcement_id); $specialty_id = Specialty::pluck('name', 'id'); $year_id = Year::pluck('name', 'id'); $classroom_id = Classroom::pluck('code', 'id'); $student_id = Student::pluck('username', 'id'); return view('announcements::edit', compact('announcement', 'specialty_id', 'year_id', 'classroom_id', 'student_id')); }
public function index(Request $request) { $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(); $county = Country::pluck('name', 'id')->toArray(); $city = City::pluck('name', 'id')->toArray(); // return $students->pluck('sps'); return view('students::students.index', compact('students', 'year_term', 'spec_id', 'county', 'city')); }
public function form(RegistrationPeriod $PeriodModel, Country $CountryModel, Specialty $Specialty, Registration $Registration, RegistrationType $type) { $registration = $Registration->with('degrees', 'contactcountry', 'contactcity', 'contactcity.states', 'birthcountry', 'nationalitycity', 'jobcountry', 'jobcountry.cities')->find(registrar()->id); $specialties = $Specialty->pluck('name', 'id')->toArray(); $registration_types = $type->pluck('title', 'id')->toArray(); $countries = $CountryModel->all(); $countries_list = ["" => ""] + $countries->pluck('name', 'id')->toArray(); $codes_list = ["" => ""] + $countries->pluck('calling_code', 'id')->toArray(); $stay_types = config('registration.stay_types'); $social_status = ["" => ""] + config('registration.social_status'); $social_job_status = ["" => "", 'unemployed' => 'بدون عمل', 'employed' => 'أعمل', 'retired' => 'متقاعد']; $years_list = ["" => ""] + array_combine(range(date("Y") - 80, date('Y')), range(date("Y") - 80, date('Y'))); $computer_skills = ["" => "", 'very_low' => 'ضعيف جدا', 'low' => 'ضعيف', 'good' => 'جيد', 'great' => 'جيد جدا', 'excellent' => 'ممتاز']; $social_job_types = ["" => "", 'government' => 'عام', 'private' => 'خاص', 'free' => 'حر']; $social_jobs = ["" => "", 'unemployed' => 'بدون عمل', 'employed' => 'أعمل', 'retired' => 'متقاعد']; $references = ["" => "", 'iiswebsite' => 'موقع كلية العلوم الشرعية', 'iisewebsite' => 'موقع مركز التعليم عن بعد', 'iisfriend' => 'صديق يدرس بالكلية', 'iisefriend' => 'صديق يدرس بمركز التعليم عن بعد', 'other' => 'أخرى']; return view('registration::registrar.form', compact('registration', 'specialties', 'registration_types', 'period', 'years_list', 'countries', 'stay_types', 'countries_list', 'references', 'computer_skills', 'codes_list', 'social_job_types', 'social_status', 'social_jobs')); }
public function export(Request $request) { Excel::create('registrations', function ($excel) { $excel->sheet('registrations', function ($sheet) { $steps = RegistrationStep::pluck('name', 'id')->toArray(); $specialties = Specialty::pluck('name', 'id')->toArray(); $type = RegistrationType::pluck('title', 'id')->toArray(); $genders = config('registration.genders'); $countries = Country::pluck('name', 'id')->toArray(); $cities = City::pluck('name', 'id')->toArray(); $states = State::pluck('name', 'id')->toArray(); $years = AcademycycleYear::pluck('name', 'id')->toArray(); $registration_periods = RegistrationPeriod::pluck('name', 'id')->toArray(); $registrations = $this->prepQuery(request()->all())->get(); $sheet->loadView('registration::registrations.export', compact('registration_periods', 'registrations', 'steps', 'countries', 'years', 'specialties', 'type', 'genders', 'cities', 'states')); })->download('xlsx'); }); }
public function pass(Request $request) { $steps = Step::pluck('name', 'id')->toArray(); $periods = Period::pluck('name', 'id')->toArray(); $current_period = Period::current()->first(); $registration_count = Registration::orderBy('id', 'desc'); $registration_gender = Registration::groupBy('gender'); $registration_specialty = Registration::groupBy('academystructure_specialty_id'); $registration_country = Registration::groupBy('contact_country_id'); $registration_step = Registration::groupBy('registration_step_id'); if (request('step_id')) { $registration_count->whereHas('histories', function ($query) { $query->where('registration_step_id', '=', request('step_id')); }); $registration_gender->whereHas('histories', function ($query) { $query->where('registration_step_id', '=', request('step_id')); }); $registration_specialty->whereHas('histories', function ($query) { $query->where('registration_step_id', '=', request('step_id')); }); $registration_country->whereHas('histories', function ($query) { $query->where('registration_step_id', '=', request('step_id')); }); $registration_step->whereHas('histories', function ($query) { $query->where('registration_step_id', '=', request('step_id')); }); } if (request('period_id')) { $registration_count->where('registration_period_id', request('period_id')); $registration_gender->where('registration_period_id', request('period_id')); $registration_specialty->where('registration_period_id', request('period_id')); $registration_country->where('registration_period_id', request('period_id')); $registration_step->where('registration_period_id', request('period_id')); } $registration_count = $registration_count->count(); $registration_gender = $registration_gender->select('gender', DB::raw('count(*) as total'))->orderBy('total', 'desc')->get()->toArray(); $registration_specialty = $registration_specialty->select('academystructure_specialty_id as specialty', DB::raw('count(*) as total'))->orderBy('total', 'desc')->get()->toArray(); $registration_country = $registration_country->select('contact_country_id as country', DB::raw('count(*) as total'))->orderBy('total', 'desc')->get()->toArray(); $registration_step = $registration_step->select('registration_step_id as step', DB::raw('count(*) as total'))->orderBy('total', 'desc')->get()->toArray(); $steps = Step::pluck('name', 'id')->toArray(); $periods = Period::pluck('name', 'id')->toArray(); $current_period = Period::current()->first(); $specialties = Specialty::pluck('name', 'id')->toArray(); $countries = Country::pluck('name', 'id')->toArray(); return view('registration::reports.pass', compact('steps', 'periods', 'current_period', 'specialties', 'countries', 'registration_gender', 'registration_specialty', 'registration_country', 'registration_step', 'registration_count')); }
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')); }