public function index(Request $request) { $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(); $cities = City::pluck('name', 'id')->toArray(); $type = Type::pluck('title', 'id')->toArray(); // $filter_period = null; if (request('period_id')) { $filter_period = request('period_id'); } if ($current_period) { $filter_period = $current_period->id; } if (!$current_period && !request('period_id')) { $filter_period = Period::orderBy('id', 'desc')->first()->id; } $registration_count = Registration::orderBy('id', 'desc'); $registration_gender = Registration::groupBy('gender'); $registration_type = Registration::groupBy('registration_type_id'); $registration_specialty = Registration::groupBy('academystructure_specialty_id'); $registration_country = Registration::groupBy('contact_country_id'); $registration_city = Registration::groupBy('contact_city_id'); $registration_step = null; if ($filter_period != null) { $registration_count->where('registration_period_id', $filter_period); $registration_gender->where('registration_period_id', $filter_period); $registration_type->where('registration_period_id', $filter_period); $registration_specialty->where('registration_period_id', $filter_period); $registration_country->where('registration_period_id', $filter_period); $registration_city->where('registration_period_id', $filter_period); } if (request('step_id')) { $registration_count->where('registration_step_id', request('step_id')); $registration_gender->where('registration_step_id', request('step_id')); $registration_type->where('registration_step_id', request('step_id')); $registration_specialty->where('registration_step_id', request('step_id')); $registration_country->where('registration_step_id', request('step_id')); $registration_city->where('registration_step_id', request('step_id')); } else { $registration_step = Registration::groupBy('registration_step_id'); if ($filter_period != null) { $registration_step->where('registration_period_id', $filter_period); } $registration_step = $registration_step->select('registration_step_id as step', DB::raw('count(*) as total'))->orderBy('total', 'desc')->get()->toArray(); } $registration_count = $registration_count->count(); $registration_gender = $registration_gender->select('gender', DB::raw('count(*) as total'))->orderBy('total', 'desc')->get()->toArray(); $registration_type = $registration_type->select('registration_type_id', 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_city = $registration_city->select('contact_city_id as city', 'contact_country_id as country', DB::raw('count(*) as total'))->orderBy('total', 'desc')->get()->toArray(); return view('registration::reports.index', compact('steps', 'periods', 'current_period', 'specialties', 'countries', 'type', 'cities', 'registration_gender', 'registration_specialty', 'registration_country', 'registration_step', 'registration_count', 'registration_type', 'registration_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 apply(RegistrationPeriod $PeriodModel, Country $CountryModel, Specialty $Specialty, RegistrationType $type) { $period = $PeriodModel->orderBy('id', 'desc')->with('year')->current()->first(); if (!$period) { return redirect()->route('welcome'); } $specialties = $Specialty->where('code', '!=', 'G')->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' => 'أخرى']; $period = $PeriodModel->orderBy('id', 'desc')->with('year')->where(function ($sql) { $sql->where('start_at', '<=', date('Y-m-d'))->where('finish_at', '>=', date('Y-m-d')); })->first(); return view('registration::registrar.apply', compact('years_list', 'specialties', 'registration_types', 'period', '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 export(Request $request) { $students = $this->prepQuery($request->all())->get(); Excel::create('students', function ($excel) use($students) { $excel->sheet('stu', function ($sheet) use($students) { $type = RegistrationType::pluck('title', 'id')->toArray(); $sheet->loadView('students::students.export', compact('students', 'type')); })->download('xlsx'); }); }