fix structure product categories table and crud product

This commit is contained in:
2025-06-02 16:21:33 +07:00
parent 59e23ae535
commit 6bf8bc4965
21 changed files with 573 additions and 141 deletions

View File

@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddParentIdToProductCategoriesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('product_categories', function (Blueprint $table) {
$table->foreignId('parent_id')->nullable()->after('name')->constrained('product_categories')->nullOnDelete();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('product_categories', function (Blueprint $table) {
$table->dropForeign(['parent_id']);
$table->dropColumn('parent_id');
});
}
}