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 index(Year $year, Period $Period) { $periods = $Period->orderBy('id', 'desc'); if ($yearId = request('academycycle_year_id')) { $periods->where('academycycle_year_id', $yearId); } if (request('running')) { $periods->current(); } $periods = $periods->get(); $years = $year->lists('name', 'id')->toArray(); return view('registration::periods.index', compact('periods', 'years')); }
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->lists('name', 'id'); $registration_types = $type->lists('title', 'id')->toArray(); $countries = $CountryModel->all(); $countries_list = ["" => ""] + $countries->lists('name', 'id')->toArray(); $codes_list = ["" => ""] + $countries->lists('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 = ["" => "", 'excellent' => 'ممتاز', 'great' => 'جيد جدا', 'very_low' => 'ضعيف جدا', 'low' => 'ضعيف', 'good' => 'جيد']; $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')); }
/** * Show the application login form for registrar. * * @return \Illuminate\Http\Response */ public function getRegLogin(RegistrationPeriod $PeriodModel) { // dd(bcrypt(123456)); $period = $PeriodModel->orderBy('id', 'desc')->with('year')->current()->first(); return view('auth.registrations.login', compact('period')); }
public function prepQuery($input = []) { $registrations = Registration::with('histories', 'student', 'step', 'period', 'period.year', 'speciality', 'contactcountry', 'degrees')->orderBy('id', 'desc'); $genders = config('registration.genders'); $search_fields = ['gender', 'registration_step_id', 'nationality_type', 'contact_country_id', 'social_status', 'social_job']; foreach ($search_fields as $field) { if (request($field)) { $registrations->whereIn($field, request($field)); } } if (request('academycycle_year')) { $registrations->whereHas('period', function ($query) { $query->whereHas('year', function ($query2) { $query2->whereIn('id', request('academycycle_year')); }); }); } if (request('registration_periods') and is_array(request('registration_periods'))) { $registrations->whereIn('registration_period_id', request('registration_periods')); } else { $period = RegistrationPeriod::orderBy('id', 'desc')->first(); $registrations->where('registration_period_id', $period->id); } if (request('name')) { $registrations->where(function ($query) { $names = explode(' ', request('name')); foreach ($names as $name) { $query->orWhere('first_name', $name); $query->orWhere('second_name', $name); $query->orWhere('third_name', $name); $query->orWhere('fourth_name', $name); } }); } $input['username'] = (!empty($input['general_search']) and strlen($input['general_search']) >= 5) ? strtoupper(substr($input['general_search'], -5, 5)) : null; if (request('general_search')) { $registrations->where(function ($query) use($input) { $query->orWhere('national_id', 'LIKE', '%' . request('general_search') . '%'); $query->orWhere('contact_mobile', 'LIKE', '%' . request('general_search') . '%'); // $query->orWhere('id', 'LIKE', request('general_search')); $query->orWhere('username', 'LIKE', '%' . $input['username'] . '%'); $query->orWhere('contact_email', 'LIKE', '%' . request('general_search') . '%'); $query->orWhere('academystructure_specialty_id', 'LIKE', request('general_search')); // $query->orWhere('username', 'LIKE', $input['username']); $names = explode(' ', request('general_search')); foreach ($names as $name) { $query->orWhere('first_name', 'LIKE', '%' . $name . '%'); $query->orWhere('second_name', 'LIKE', '%' . $name . '%'); $query->orWhere('third_name', 'LIKE', '%' . $name . '%'); $query->orWhere('fourth_name', 'LIKE', '%' . $name . '%'); $query->orWhere('last_name', 'LIKE', '%' . $name . '%'); } }); } if (request('national_id')) { $registrations->where('national_id', request('national_id')); } if (request('academystructure_specialty_id')) { $registrations->whereIn('academystructure_specialty_id', request('academystructure_specialty_id')); } if (request('contact_mobile')) { $registrations->where('contact_mobile', request('contact_mobile')); } if (request('id')) { $registrations->where('id', request('id')); } if (request('contact_email')) { $registrations->where('contact_email', request('contact_email')); } return $registrations; }
public function index(RegistrationPeriod $PeriodModel) { $period = $PeriodModel->orderBy('id', 'desc')->with('year')->current()->first(); $registration = registrar(); return view('registration::registrar.index', compact('period', 'registration')); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index(RegistrationPeriod $PeriodModel) { $period = $PeriodModel->orderBy('id', 'desc')->with('year')->current()->first(); return view('welcome', compact('period')); }