Пример #1
0
 public function importAppointments()
 {
     if (Input::hasFile('file')) {
         $file = Input::file('file');
         Appointment::truncate();
         Excel::load($file, function ($reader) {
             $reader->setDateFormat('j/n/Y H:i:s');
             $results = $reader->get();
             foreach ($results as $result) {
                 $args = ['user_id' => 2, 'lead_id' => $result->lead_id, 'agent_id' => NULL, 'appointment_confirmed' => $result->confirmed, 'appointment_date' => Carbon::parse($result->appointment_set_date)];
                 Appointment::create($args);
                 $lead = Lead::find($result->lead_id);
                 if ($lead) {
                     $lead->lead_acceptance_type = $result->dta;
                     $lead->save();
                 }
                 var_dump($result);
             }
         });
     }
 }
Пример #2
0
 public function createAppointment(Request $request)
 {
     $value = $this->getAuthenticatedUser()->getData();
     try {
         $appointment = Appointment::create(['doctorId' => $request->input('doctorId'), 'screeningId' => $request->input('screeningId'), 'requestedBy' => $value->result->id, 'status' => 'pending']);
     } catch (\Exception $e) {
         return response()->json(['error' => ['message' => 'Could not assign doctor', 'code' => 400]], HttpResponse::HTTP_CONFLICT);
     }
     return response()->json(['result' => $appointment]);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $data = $request->all();
     $validator = $this->validator($data);
     if ($validator->fails()) {
         return response(['errors' => $validator->messages()], 400);
     }
     // create appointment address (identical to the user's address but NOT the same)
     $oldAddress = Address::find($data['address_id']);
     $newAddress = new Address();
     $address = $newAddress->create(array_except($oldAddress->toArray(), ['id']));
     $data = array_except($data, ['address_id']);
     $data['end_user_id'] = Auth::user()->userable->id;
     // store
     $appointment = new Appointment();
     $newAppointment = $appointment->create($data);
     // Insert related address
     $newAppointment->address()->associate($address);
     // Reward user for online appointment
     $points = Config::get('services.points.online_appointment');
     Auth::user()->userable->addPoints($points, 'Online appointment');
     $newAppointment['points_rewarded'] = $points;
     return response($newAppointment->load('address')->load('mastori'), 201);
 }
Пример #4
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     //
     $rules = $this->getAppointValRules();
     //dd($request->all());
     $validator = Validator::make($request->all(), $rules);
     if ($validator->fails()) {
         # code...
         return redirect()->back()->withErrors($validator);
     }
     $input = $request->all();
     $appointment = Appointment::create(['user_id' => Auth::user()->id, 'appoint_date' => $input['appoint_date'], 'appoint_time' => $input['appoint_time'], 'available' => true]);
     return redirect('doctor/appointment');
 }
Пример #5
0
 public function run()
 {
     DB::table('appointments')->delete();
     Appointment::create(['id' => 1, 'date' => "9/3/2015", 'time' => "8:00-10:00AM", 'location' => "Warrensburg"]);
     Appointment::create(['id' => 2, 'date' => "4/3/2015", 'time' => "9:00-10:00AM", 'location' => "Lee Summit"]);
 }