From 4833cf9225f72867798af4be361b07bd6baef1c5 Mon Sep 17 00:00:00 2001 From: Masroor Ehsan Date: Wed, 1 Jan 2025 16:31:03 +0600 Subject: [PATCH] wip billing --- app/Http/Requests/BillingGroupRequest.php | 22 ++++++++++++++++ .../Requests/BillingRadiologistRequest.php | 21 ++++++++++++++++ app/Models/BillingGroup.php | 15 +++++++++++ app/Models/BillingRadiologist.php | 19 ++++++++++++++ ..._01_101623_create_billing_groups_table.php | 24 ++++++++++++++++++ ...2957_create_billing_radiologists_table.php | 25 +++++++++++++++++++ 6 files changed, 126 insertions(+) create mode 100644 app/Http/Requests/BillingGroupRequest.php create mode 100644 app/Http/Requests/BillingRadiologistRequest.php create mode 100644 app/Models/BillingGroup.php create mode 100644 app/Models/BillingRadiologist.php create mode 100644 database/migrations/2025_01_01_101623_create_billing_groups_table.php create mode 100644 database/migrations/2025_01_01_102957_create_billing_radiologists_table.php diff --git a/app/Http/Requests/BillingGroupRequest.php b/app/Http/Requests/BillingGroupRequest.php new file mode 100644 index 0000000..6508795 --- /dev/null +++ b/app/Http/Requests/BillingGroupRequest.php @@ -0,0 +1,22 @@ + ['required'], + 'description' => ['nullable'], + 'is_active' => ['boolean'], + ]; + } + + public function authorize(): bool + { + return true; + } +} diff --git a/app/Http/Requests/BillingRadiologistRequest.php b/app/Http/Requests/BillingRadiologistRequest.php new file mode 100644 index 0000000..80f334a --- /dev/null +++ b/app/Http/Requests/BillingRadiologistRequest.php @@ -0,0 +1,21 @@ + ['required', 'exists:billing_groups'], + 'radiologist_id' => ['required', 'exists:users'], + ]; + } + + public function authorize(): bool + { + return true; + } +} diff --git a/app/Models/BillingGroup.php b/app/Models/BillingGroup.php new file mode 100644 index 0000000..051b8db --- /dev/null +++ b/app/Models/BillingGroup.php @@ -0,0 +1,15 @@ + 'boolean', + ]; + } +} diff --git a/app/Models/BillingRadiologist.php b/app/Models/BillingRadiologist.php new file mode 100644 index 0000000..6994cb0 --- /dev/null +++ b/app/Models/BillingRadiologist.php @@ -0,0 +1,19 @@ +belongsTo(BillingGroup::class); + } + + public function radiologist(): BelongsTo + { + return $this->belongsTo(User::class, 'radiologist_id'); + } +} diff --git a/database/migrations/2025_01_01_101623_create_billing_groups_table.php b/database/migrations/2025_01_01_101623_create_billing_groups_table.php new file mode 100644 index 0000000..fb68434 --- /dev/null +++ b/database/migrations/2025_01_01_101623_create_billing_groups_table.php @@ -0,0 +1,24 @@ +id(); + $table->boolean('is_active')->index(); + $table->string('name')->unique(); + $table->text('description')->nullable(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('billing_groups'); + } +}; diff --git a/database/migrations/2025_01_01_102957_create_billing_radiologists_table.php b/database/migrations/2025_01_01_102957_create_billing_radiologists_table.php new file mode 100644 index 0000000..c838231 --- /dev/null +++ b/database/migrations/2025_01_01_102957_create_billing_radiologists_table.php @@ -0,0 +1,25 @@ +id(); + $table->foreignId('billing_group_id')->constrained('billing_groups')->nullOnDelete(); + $table->foreignId('radiologist_id')->constrained('users')->nullOnDelete(); + $table->timestamps(); + + $table->unique(['billing_group_id', 'radiologist_id']); + }); + } + + public function down(): void + { + Schema::dropIfExists('billing_radiologists'); + } +};