diff --git a/app/Models/Study.php b/app/Models/Study.php index 4af6288..0ad125f 100644 --- a/app/Models/Study.php +++ b/app/Models/Study.php @@ -16,9 +16,9 @@ class Study extends BaseModel 'report_status' => ReportStatus::class, ]; - public function history(): HasOne + public function details(): HasOne { - return $this->hasOne(StudyHistory::class); + return $this->hasOne(StudyDetails::class); } public function attachments(): HasMany diff --git a/app/Models/StudyHistory.php b/app/Models/StudyDetails.php similarity index 78% rename from app/Models/StudyHistory.php rename to app/Models/StudyDetails.php index afe09a0..550c97f 100644 --- a/app/Models/StudyHistory.php +++ b/app/Models/StudyDetails.php @@ -4,8 +4,10 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; -class StudyHistory extends BaseModel +class StudyDetails extends BaseModel { + protected $table = 'study_details'; + public function study(): BelongsTo { return $this->belongsTo(Study::class); diff --git a/database/migrations/2024_12_27_060234_create_studies_table.php b/database/migrations/2024_12_27_060234_create_studies_table.php index 01e2925..2d85e1d 100644 --- a/database/migrations/2024_12_27_060234_create_studies_table.php +++ b/database/migrations/2024_12_27_060234_create_studies_table.php @@ -31,11 +31,6 @@ public function up(): void $table->string('accession_number')->nullable(); $table->string('study_description')->nullable(); $table->string('body_part_examined')->nullable(); - $table->string('station_name')->nullable(); - $table->string('operators_name')->nullable(); - $table->string('manufacturer')->nullable(); - $table->string('manufacturer_model_name')->nullable(); - $table->string('software_versions')->nullable(); $table->string('referring_physician_name')->nullable(); $table->string('study_modality', 4)->nullable(); diff --git a/database/migrations/2024_12_29_144858_create_study_histories_table.php b/database/migrations/2024_12_28_144858_create_study_details_table.php similarity index 63% rename from database/migrations/2024_12_29_144858_create_study_histories_table.php rename to database/migrations/2024_12_28_144858_create_study_details_table.php index 061b268..4b4b840 100644 --- a/database/migrations/2024_12_29_144858_create_study_histories_table.php +++ b/database/migrations/2024_12_28_144858_create_study_details_table.php @@ -8,7 +8,7 @@ { public function up(): void { - Schema::create('study_histories', function (Blueprint $table) { + Schema::create('study_details', function (Blueprint $table) { $table->id(); $table->foreignId('study_id')->index()->constrained('studies')->cascadeOnDelete(); $table->foreignId('user_id')->constrained('users'); @@ -16,12 +16,17 @@ public function up(): void $table->text('surgical_history')->nullable(); $table->text('lab_results')->nullable(); $table->text('clinical_diagnosis')->nullable(); + $table->string('station_name')->nullable(); + $table->string('operators_name')->nullable(); + $table->string('manufacturer')->nullable(); + $table->string('manufacturer_model_name')->nullable(); + $table->string('software_versions')->nullable(); $table->timestamps(); }); } public function down(): void { - Schema::dropIfExists('study_histories'); + Schema::dropIfExists('study_details'); } };