public function store($school_name) { //Checks if user is authorised to add a new tuple if (\Auth::check()) { $newdepartmentname = Request::get('departmentname'); //gets the department name from the department view $newdepartmenturl = Request::get('departmentURL'); //gets the department url from the department view //adds a new tuple to the department table. Note department number is an auto incremented integer. department::insert(['department_name' => $newdepartmentname, 'dept_url' => $newdepartmenturl, 'school_name' => $school_name]); $message = "Department Added: Success!"; // indicates that the tuple was added } else { $message = " Department Added: Failed"; } // indicates that the new tuple was not added //filters department table based on $school_name, which was passed into function. It includes new Tuple if successful $departmenttable = department::where('school_name', '=', $school_name)->get(); //Tells user if logged in or not in view if (\Auth::check()) { $name = \Auth::user()->name; } else { $name = "Guest"; } //returns the view department. It passes the departmenttable, school_name, message, and name to the view return view('department', compact('departmenttable'), compact('school_name', 'message', 'name')); }
public static function getDepartmentArrayWithUnknown() { $department = department::all(); $results = array(); $results['0'] = 'ไม่ระบุ'; foreach ($department as $d) { $results[$d->departmentId] = $d->departmentName; } return $results; }
public function testfunc() { echo '<!DOCTYPE html> <meta charset="utf-8">'; $pp = patient::where('userId', 3)->first(); $app = appointment::where('appointmentId', 1)->first(); $doc = doctor::where('userId', 4)->first(); $schedule = schedule::where('scheduleId', 1)->first(); $dep = department::where('departmentId', 2)->first(); // $doc->getScheduleInRange(2015, 12); $results = $doc->getDiagStats(2015, 12); foreach ($results as $date) { echo $date['date'] . ' ' . $date['morning'] . ' ' . $date['afternoon'] . ' ' . $date['sum'] . '<br>'; } // return view('testSearch')->with('patient', $pp)->with('ap', $app)->with('doctor', $doc)->with('sc', $schedule)->with('idd', $schedule->scheduleId)->with('department', $dep); }
public function addDepartment(Request $request) { $input = $request->all(); department::create($input); return redirect('/addDepartment'); }
public static function determineDepartment($id) { return department::where('id', $id)->firstOrFail()->department; }
public function addHospitalStaffShow() { $department = department::all(); $depList = array(); foreach ($department as $item) { $depList[$item['departmentId']] = $item['departmentName']; } return view('staff/addStaffByStaff')->with('department', $depList); }
public function createAppointmentByStaffShow($patientId) { $patient = patient::where('userId', $patientId)->first(); $department = department::all(); $depList = array(); $depList['0'] = 'ไม่ระบุ'; foreach ($department as $item) { $depList[$item['departmentId']] = $item['departmentName']; } $doctor = department::getDoctorArray(); return view('staff.createAppointmentForPatient2')->with('patient', $patient)->with('department', $depList)->with('doctor', $doctor); }
public static function getDepartmentsOptions() { $departments = department::all(); $output = "<option value = ''>Any department</option>"; foreach ($departments as $department) { $selected = isset($_POST['department']) && $_POST['department'] == $department->id ? "selected" : ""; $output .= "<option " . $selected . " value = '" . $department->id . "'>" . $department->department . "</option>"; } echo $output; }