wip billing
This commit is contained in:
parent
5d56d24ea6
commit
4833cf9225
22
app/Http/Requests/BillingGroupRequest.php
Normal file
22
app/Http/Requests/BillingGroupRequest.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class BillingGroupRequest extends FormRequest
|
||||
{
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'name' => ['required'],
|
||||
'description' => ['nullable'],
|
||||
'is_active' => ['boolean'],
|
||||
];
|
||||
}
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
21
app/Http/Requests/BillingRadiologistRequest.php
Normal file
21
app/Http/Requests/BillingRadiologistRequest.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class BillingRadiologistRequest extends FormRequest
|
||||
{
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'billing_group_id' => ['required', 'exists:billing_groups'],
|
||||
'radiologist_id' => ['required', 'exists:users'],
|
||||
];
|
||||
}
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
15
app/Models/BillingGroup.php
Normal file
15
app/Models/BillingGroup.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class BillingGroup extends Model
|
||||
{
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
}
|
||||
}
|
19
app/Models/BillingRadiologist.php
Normal file
19
app/Models/BillingRadiologist.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class BillingRadiologist extends Model
|
||||
{
|
||||
public function billingGroup(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(BillingGroup::class);
|
||||
}
|
||||
|
||||
public function radiologist(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'radiologist_id');
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('billing_groups', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->boolean('is_active')->index();
|
||||
$table->string('name')->unique();
|
||||
$table->text('description')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('billing_groups');
|
||||
}
|
||||
};
|
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('billing_radiologists', function (Blueprint $table) {
|
||||
$table->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');
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user