model
This commit is contained in:
parent
64dfa4ac3d
commit
5ac60bb9bc
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
use App\Models\Enums\ReportStatus;
|
use App\Models\Enums\ReportStatus;
|
||||||
use App\Models\Enums\StudyLevelStatus;
|
use App\Models\Enums\StudyLevelStatus;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||||
|
|
||||||
class Study extends BaseModel
|
class Study extends BaseModel
|
||||||
@ -19,4 +20,14 @@ public function history(): HasOne
|
|||||||
{
|
{
|
||||||
return $this->hasOne(StudyHistory::class);
|
return $this->hasOne(StudyHistory::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function attachments(): HasMany
|
||||||
|
{
|
||||||
|
return $this->hasMany(StudyAttachment::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reports(): HasMany
|
||||||
|
{
|
||||||
|
return $this->hasMany(StudyReport::class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,4 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
class StudyNote extends BaseModel {}
|
||||||
|
|
||||||
class StudyNote extends Model {}
|
|
||||||
|
@ -2,4 +2,17 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
class Template extends BaseModel {}
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
|
||||||
|
class Template extends BaseModel
|
||||||
|
{
|
||||||
|
public function owner(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class, 'owner_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function category(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(TemplateCategory::class, 'category_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -12,8 +12,8 @@ public function up(): void
|
|||||||
{
|
{
|
||||||
Schema::create('study_notes', function (Blueprint $table) {
|
Schema::create('study_notes', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->foreignIdFor(Study::class)->constrained()->onDelete('cascade');
|
$table->foreignIdFor(Study::class)->constrained()->cascadeOnDelete();
|
||||||
$table->foreignIdFor(User::class)->nullable()->constrained()->onDelete('cascade');
|
$table->foreignIdFor(User::class)->nullable()->constrained()->cascadeOnDelete();
|
||||||
$table->string('title')->nullable();
|
$table->string('title')->nullable();
|
||||||
$table->longText('content');
|
$table->longText('content');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
|
@ -14,8 +14,9 @@ public function up(): void
|
|||||||
Schema::create('study_reports', function (Blueprint $table) {
|
Schema::create('study_reports', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->unsignedTinyInteger('report_status')->default(ReportStatus::Pending->value);
|
$table->unsignedTinyInteger('report_status')->default(ReportStatus::Pending->value);
|
||||||
$table->foreignIdFor(Study::class)->index()->constrained()->onDelete('cascade');
|
$table->foreignIdFor(Study::class)->index()->constrained()->cascadeOnDelete();
|
||||||
$table->foreignIdFor(User::class)->index()->constrained()->onDelete('cascade');
|
$table->foreignIdFor(User::class, 'radiologist_id')->index()->constrained()->cascadeOnDelete();
|
||||||
|
$table->string('report_title')->nullable();
|
||||||
$table->string('file_path');
|
$table->string('file_path');
|
||||||
$table->string('pdf_path')->nullable();
|
$table->string('pdf_path')->nullable();
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
|
Loading…
Reference in New Issue
Block a user