firstcommit

This commit is contained in:
2025-08-17 16:23:14 +05:45
commit 76bf4c0a18
2648 changed files with 362795 additions and 0 deletions

View File

@@ -0,0 +1,107 @@
<?php
namespace Modules\Appointment\app\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Modules\Appointment\app\Repositories\AppointmentRepository;
use Modules\Appointment\app\Http\Requests\CreateAppointmentRequest;
class AppointmentController extends Controller
{
protected $appointmentRepository;
public function __construct()
{
$this->appointmentRepository = new AppointmentRepository;
}
/**
* Display a listing of the resource.
*/
public function index(Request $request)
{
$perPage = $request->has('per-page') ? $request->input('per-page') : null;
$filter = $request->has('filter') ? $request->input('filter') : [];
$data['appointments'] = $this->appointmentRepository->allAppointmentList($perPage, $filter);
$data['appointmentCount'] = $data['appointments']->count();
return view('appointment::index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
return view('appointment::create');
}
/**
* Store a newly created resource in storage.
*/
public function store(CreateAppointmentRequest $request): RedirectResponse
{
try {
$validated = $request->validated();
$this->appointmentRepository->storeAppointmentList($validated);
toastr()->success('Appointment created successfully.');
return redirect()->route('doctor_provider');
} catch (\Throwable $th) {
report($th);
toastr()->error('Something went wrong.');
return back();
}
}
/**
* Show the specified resource.
*/
public function show($uuid)
{
$data['appointment'] = $this->appointmentRepository->findAppointmentListById($uuid);
return view('appointment::show', $data);
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
return view('appointment::edit');
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy($uuid)
{
try {
$appointment = $this->appointmentRepository->deleteAppointmentList($uuid);
if (!$appointment) {
toastr()->error('Appointment not found.');
return back();
}
toastr()->success('Appointment deleted successfully.');
return redirect()->route('cms.appointment.index');
} catch (\Throwable $th) {
report($th);
toastr()->error('Something went wrong.');
return back();
}
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace Modules\Appointment\app\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class CreateAppointmentRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules(): array
{
return [
'team_member_id' => 'required|integer',
'full_name' => 'required|string|max:150',
'email' => 'required|email',
'contact_no' => 'required|string',
'subject' => 'required|string|max:500',
'feedback' => 'required|string',
];
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
}