feat(Category): add category

This commit is contained in:
2026-05-03 23:38:21 +03:30
parent ededb41a3a
commit 21b060c527
13 changed files with 300 additions and 5 deletions

View File

@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('judicial_precedent_categories', function (Blueprint $table) {
$table->id();
$table->string('name')->unique()->comment('نام دسته‌بندی');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('judicial_precedent_categories');
}
};

View File

@@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('judicial_precedents', function (Blueprint $table) {
$table->foreignId('category_id')->nullable()->constrained('judicial_precedent_categories')->onDelete('set null')->comment('دسته‌بندی');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('judicial_precedents', function (Blueprint $table) {
$table->dropForeign(['category_id']);
$table->dropColumn('category_id');
});
}
};