public function discardStaff($empId) { if (!HospitalEmployee::isStaff()) { return response()->json(["success" => false, "error" => 'notlogin or notvalid']); } $emp = HospitalEmployee::where('emp_id', $empId)->first(); $usr = User::find($empId); if ($emp->valid) { // echo 'valid=false'; return response()->json(["success" => false, "error" => 'valid = true']); } // DB::table('HospitalEmployee')->where('emp_id',$empId)->delete(); $emp->delete(); $usr->delete(); return response()->json(["success" => true]); }
public function getLastAppointment($patient_id) { if (!Patient::isPatient() && !HospitalEmployee::isDoctor() && !HospitalEmployee::isStaff()) { return response()->json(["success" => false, "error" => 'notlogin or notvalid']); } return response()->json(["success" => true, "data" => Appointment::getLastAppointment($patient_id)]); }