This commit is contained in:
Masroor Ehsan 2024-12-31 13:56:54 +06:00
parent a12585b7f0
commit 2e2b30cc13
8 changed files with 92 additions and 1 deletions

21
app/Models/Facility.php Normal file
View File

@ -0,0 +1,21 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Facility extends Model
{
public function institute(): BelongsTo
{
return $this->belongsTo(Institute::class);
}
protected function casts(): array
{
return [
'is_active' => 'boolean',
];
}
}

View File

@ -0,0 +1,7 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class OrthancHost extends Model {}

View File

@ -123,4 +123,8 @@
'store' => env('APP_MAINTENANCE_STORE', 'database'),
],
'pagination' => [
'study_counts' => [5, 10, 25, 50, 100],
],
];

View File

@ -12,6 +12,8 @@ public function up(): void
$table->id();
$table->string('name')->unique();
$table->boolean('is_active')->default(false);
$table->string('address')->nullable();
$table->string('logo_path')->nullable();
$table->timestamps();
});
}

View File

@ -0,0 +1,26 @@
<?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('facilities', function (Blueprint $table) {
$table->id();
$table->boolean('is_active')->default(false);
$table->foreignId('institute_id')->constrained('institutes')->cascadeOnDelete();
$table->string('name');
$table->timestamps();
$table->unique(['institute_id', 'name']);
});
}
public function down(): void
{
Schema::dropIfExists('facilities');
}
};

View File

@ -1,6 +1,7 @@
<?php
use App\Models\Enums\UserRole;
use App\Models\Facility;
use App\Models\Institute;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
@ -28,6 +29,7 @@ public function up(): void
$table->foreignId('current_team_id')->nullable();
$table->string('profile_photo_path')->nullable();
$table->foreignIdFor(Institute::class)->nullable()->index();
$table->foreignIdFor(Facility::class)->nullable()->index();
$table->string('timezone')->default('Asia/Dhaka');
$table->timestamp('last_seen_at')->nullable();
$table->rememberToken();

View File

@ -2,6 +2,7 @@
use App\Models\Enums\ReportStatus;
use App\Models\Enums\StudyLevelStatus;
use App\Models\Facility;
use App\Models\Institute;
use App\Models\User;
use Illuminate\Database\Migrations\Migration;
@ -40,7 +41,8 @@ public function up(): void
$table->dateTime('reported_at')->nullable();
$table->dateTime('authorized_at')->nullable();
$table->foreignIdFor(Institute::class)->constrained()->onDelete('cascade');
$table->foreignIdFor(Institute::class)->constrained()->cascadeOnDelete();
$table->foreignIdFor(Facility::class)->nullable()->constrained()->cascadeOnDelete();
$table->unsignedTinyInteger('study_status')->default(StudyLevelStatus::Pending->value);
$table->unsignedTinyInteger('report_status')->default(ReportStatus::Pending->value);

View File

@ -0,0 +1,27 @@
<?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('orthanc_hosts', function (Blueprint $table) {
$table->id();
$table->string('server_name')->unique();
$table->string('fqdn')->unique();
$table->string('ae_title')->nullable();
$table->string('stone_viewer_url')->nullable();
$table->string('ohif_viewer_url')->nullable();
$table->string('meddream_viewer_url')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('orthanc_hosts');
}
};