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'); + } +};