public function index(Registration $Registration) { $registrations = $Registration->with('step', 'period', 'period.year')->orderBy('id', 'desc'); $steps = RegistrationStep::lists('name', 'id')->toArray(); $countries = Country::lists('name', 'id')->toArray(); $search_fields = ['gender', 'registration_step_id', 'nationality_type', 'contact_country_id', 'social_status', 'social_job']; $years = AcademycycleYear::lists('name', 'id')->toArray(); $genders = config('registration.genders'); 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('national_id')) { $registrations->where('national_id', request('national_id')); } if (request('contact_email')) { $registrations->where('contact_email', request('contact_email')); } $registrations = $registrations->paginate(50); return view('registration::registrations.index', compact('registrations', 'steps', 'countries', 'years')); }
public function create(Year $Year) { $years = $Year->lists('name', 'id')->toArray(); if (request('redirectTo')) { session()->put('redirectTo', request('redirectTo')); } return view('academycycle::years.create', compact('years')); }
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')); }