templates

This commit is contained in:
Dr Masroor Ehsan 2024-12-29 12:51:32 +06:00
parent d07a222492
commit 2c12297d93
5 changed files with 69 additions and 0 deletions

7
app/Models/Template.php Normal file
View File

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

View File

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

View File

@ -44,6 +44,7 @@ public static function ohifSegmentation(string $study_uid): string
return (string) $url;
}
public static function archive(string $study_uid): string
{
$url = Url::createFromUrl(config('pacs.api.endpoint'));

View File

@ -0,0 +1,22 @@
<?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('template_categories', function (Blueprint $table) {
$table->id();
$table->string('name')->unique();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('template_categories');
}
};

View File

@ -0,0 +1,32 @@
<?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('templates', function (Blueprint $table) {
$table->id();
$table->foreignId('category_id')->constrained('template_categories')->cascadeOnDelete();
$table->foreignId('owner_id')->nullable()->constrained('users')->nullOnDelete();
$table->boolean('is_private')->default(false);
$table->unsignedTinyInteger('priority')->default(0);
$table->string('title');
$table->longText('content');
$table->string('tags')->nullable();
$table->timestamps();
$table->index(['is_private', 'priority', 'title']);
$table->index(['category_id', 'is_private', 'priority', 'title']);
$table->index(['owner_id', 'is_private', 'priority', 'title']);
});
}
public function down(): void
{
Schema::dropIfExists('templates');
}
};