Create Career
- List - --
- -
diff --git a/app/Http/Controllers/Admin/AppointmentController.php b/app/Http/Controllers/Admin/AppointmentController.php new file mode 100644 index 0000000..cdc10bd --- /dev/null +++ b/app/Http/Controllers/Admin/AppointmentController.php @@ -0,0 +1,94 @@ +whereDate('date',$key); + } + if(\request('status')){ + $key = \request('status'); + $appointments = $appointments->where('status',$key); + } + $appointments = $appointments->paginate(config('custom.per_page')); + return view($this->view.'index',compact('appointments')); + } + + public function create() + { + return view($this->view.'create'); + } + + public function store(Request $request) + { + $request->validate([ + 'date' => 'required|date', + 'start_time' => 'required|date_format:H:i', + 'end_time' => 'required|date_format:H:i', + // 'location' => 'required|max:255', + // 'description' => 'required', + ]); + + $appointment = new Appointment([ + 'date' => $request->get('date'), + 'start_time' => $request->get('start_time'), + 'end_time' => $request->get('end_time'), + 'location' => $request->get('location'), + 'description' => $request->get('description'), + ]); + + $appointment->save(); + + return redirect($this->redirect)->with('success', 'Appointment has been added'); + } + + public function edit($id) + { + $appointment = Appointment::find($id); + + return view($this->view.'edit', compact('appointment')); + } + + public function update(Request $request, $id) + { + $request->validate([ + 'date' => 'required|date', + 'start_time' => 'required|date_format:H:i', + 'end_time' => 'required|date_format:H:i', + // 'location' => 'required|max:255', + // 'description' => 'required', + ]); + + $appointment = Appointment::find($id); + $appointment->date = $request->get('date'); + $appointment->start_time = $request->get('start_time'); + $appointment->end_time = $request->get('end_time'); + $appointment->location = $request->get('location'); + $appointment->description = $request->get('description'); + $appointment->save(); + + return redirect($this->redirect)->with('success', 'Appointment has been updated'); + } + + public function destroy($id) + { + $appointment = Appointment::find($id); + $appointment->delete(); + + return redirect($this->redirect)->with('success', 'Appointment has been deleted'); + } +} + diff --git a/app/Models/Appointment.php b/app/Models/Appointment.php new file mode 100644 index 0000000..408a7c5 --- /dev/null +++ b/app/Models/Appointment.php @@ -0,0 +1,13 @@ +id(); + $table->date('date'); + $table->string('start_time'); + $table->string('end_time'); + $table->string('location')->nullable(); + $table->string('description')->nullable(); + $table->enum('status',[1,2]); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('appointments'); + } +}; diff --git a/resources/views/admin/applicant/create.blade.php b/resources/views/admin/applicant/create.blade.php deleted file mode 100644 index 4614e64..0000000 --- a/resources/views/admin/applicant/create.blade.php +++ /dev/null @@ -1,157 +0,0 @@ -@extends('admin.layouts.app') -@section('content') - -
+ Appointments +
+ +