public function compose(View $view) { $view->with('centres', \App\Centre::all()); }
/** * Show the index page for all locations/centres. * Responds to requests to GET /centres * * @return Response */ public function index() { $centres = Centre::all(); return view('centres.index', compact('centres')); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $centres = Centre::all(); return view('admin.centres.base', ['centres' => $centres]); }
/** * Show the form to edit an elderly/senior. * Responds to requests to GET /elderly/{id}/edit * * @param int $id the ID of the elderly/senior * @return Response */ public function edit($id) { $validator = JsValidator::formRequest('App\\Http\\Requests\\EditElderlyRequest'); $elderly = Elderly::findOrFail($id); $genderList = ['M' => 'Male', 'F' => 'Female']; $languages = ElderlyLanguage::distinct()->lists('language', 'language')->sort(); if (Auth::user()->is_admin) { $centreList = Centre::all()->lists('name', 'centre_id')->sort(); } else { $centreList = Auth::user()->centres()->get()->lists('name', 'centre_id')->sort(); } if (is_array(old('languages'))) { foreach (old('languages') as $l) { $languages[$l] = $l; } } return view('elderly.edit', compact('validator', 'elderly', 'centreList', 'genderList', 'languages')); }
/** * Show the form to edit a staff. * Responds to requests to GET /staff/{id}/edit * * @param int $id the ID of the staff * @return Response */ public function edit($id) { if (Auth::user()->staff_id == $id && !Auth::user()->is_admin) { return redirect('staff')->withErrors(['You cannot edit your own profile.']); } $validator = JsValidator::formRequest('App\\Http\\Requests\\EditStaffRequest'); $staff = Staff::findOrFail($id); $staffType = [false => 'Regular Staff', true => 'Administrator']; if (Auth::user()->is_admin) { $centreList = Centre::all()->lists('name', 'centre_id')->sort(); } else { $centreList = Auth::user()->centres()->get()->lists('name', 'centre_id'); } return view('staff.edit', compact('validator', 'staff', 'staffType', 'centreList')); }
/** * Show the form to edit an activity. * Responds to requests to GET /activities/{id}/edit * * @param int $id the ID of the activity * @return Response */ public function edit($id) { $validator = JsValidator::formRequest('App\\Http\\Requests\\EditActivityRequest'); $activity = Activity::findOrFail($id); if (Auth::user()->is_admin) { $centreList = Centre::all()->lists('name', 'centre_id')->sort(); } else { $centreList = Auth::user()->centres()->get()->lists('name', 'centre_id')->sort(); } $locationList = Centre::all()->lists('name', 'centre_id'); $seniorList = Elderly::all()->lists('elderly_list', 'elderly_id'); $timePeriodList = ['AM' => 'AM', 'PM' => 'PM']; $locationList = $locationList->sort()->put('others', 'Others'); $seniorList = $seniorList->sort()->put('others', 'Others'); $genderList = ['M' => 'Male', 'F' => 'Female']; $seniorLanguages = ElderlyLanguage::distinct()->lists('language', 'language')->sort(); return view('activities.edit', compact('validator', 'activity', 'centreList', 'timePeriodList', 'locationList', 'seniorList', 'genderList', 'seniorLanguages')); }
public function compose(View $view) { $examList = array('' => 'Select a exam date') + DB::table('sittings')->select(DB::raw('concat (month," / ",year) as sitting,id'))->lists('sitting', 'id'); $view->with('methodList', \App\Method::all())->with('levelList', \App\Level::all())->with('paperList', \App\Paper::all())->with('centreList', \App\Centre::all())->with('elementList', \App\Element::all())->with('examList', $examList); }