diff --git a/app/Http/Controllers/Admin/AppointmentController.php b/app/Http/Controllers/Admin/AppointmentController.php index cdc10bd..0daadb8 100644 --- a/app/Http/Controllers/Admin/AppointmentController.php +++ b/app/Http/Controllers/Admin/AppointmentController.php @@ -48,6 +48,8 @@ class AppointmentController extends Controller 'end_time' => $request->get('end_time'), 'location' => $request->get('location'), 'description' => $request->get('description'), + 'service_type' => $request->get('service_type'), + ]); $appointment->save(); @@ -78,6 +80,7 @@ class AppointmentController extends Controller $appointment->end_time = $request->get('end_time'); $appointment->location = $request->get('location'); $appointment->description = $request->get('description'); + $appointment->service_type = $request->get('service_type'); $appointment->save(); return redirect($this->redirect)->with('success', 'Appointment has been updated'); diff --git a/app/Http/Controllers/AppointmentController.php b/app/Http/Controllers/AppointmentController.php new file mode 100644 index 0000000..c533a93 --- /dev/null +++ b/app/Http/Controllers/AppointmentController.php @@ -0,0 +1,41 @@ +get(); + $visaAppointments = Appointment::where('service_type', '2')->get(); + // foreach($educationAppointments as $appointment){ + // $startTime = Carbon::createFromFormat('H:i', $appointment->start_time); + // $date = Carbon::createFromFormat('H:i', $appointment->start_time); + // dd($date); + // } + return view('appointment', compact('educationAppointments', 'visaAppointments')); + + } + + public function get_appointment_by_date(Request $request){ + $dateTime = $request->date; + $date_parts = explode(" ", $dateTime); + $month_number = date_parse($date_parts[1])['month']; + $carbon = Carbon::createFromDate($date_parts[3], $month_number, $date_parts[2]); + + $date = $carbon->format('Y-m-d'); + + $appointments = Appointment::whereDate('date',$date)->where('status',1)->get(); + // $users = DB::table('appointments')->whereDate('created_at', '2022-12-01')->get(); + // $time = []; + // foreach($appointments as $appointment){ + // array_push($time, [$appointment->start_time, $appointment->id]); + // } + // dd($time); + return response()->json(['appointment' => $appointments]); + } +} diff --git a/config/custom.php b/config/custom.php index 266b0c7..7f4bc32 100644 --- a/config/custom.php +++ b/config/custom.php @@ -53,6 +53,10 @@ return [ '12'=>'page' ], + 'service_type' => [ + '1' => 'Education', + '2' => 'Visa' + ], 'course_types'=>[ '1' =>'Upcoming Courses', '2' =>'Recommended Courses', diff --git a/database/migrations/2023_02_07_044441_add_service_type_id_to_appointments_table.php b/database/migrations/2023_02_07_044441_add_service_type_id_to_appointments_table.php new file mode 100644 index 0000000..1663a10 --- /dev/null +++ b/database/migrations/2023_02_07_044441_add_service_type_id_to_appointments_table.php @@ -0,0 +1,32 @@ +enum('service_type',[1,2]); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('appointments', function (Blueprint $table) { + // + }); + } +}; diff --git a/resources/views/admin/appointment/create.blade.php b/resources/views/admin/appointment/create.blade.php index 495ae62..c72a4fd 100644 --- a/resources/views/admin/appointment/create.blade.php +++ b/resources/views/admin/appointment/create.blade.php @@ -28,6 +28,17 @@ @include('errors.error') {!! Form::open(['url' => '/admin/appointments', 'class' => 'form-horizontal', 'method'=> 'POST','files' => true,'autocomplete' => 'OFF']) !!}