diff --git a/database/migrations/2024_08_11_023807_create_branches_table.php b/database/migrations/2024_08_11_023807_create_branches_table.php index bf4e9a8..0f15b5e 100644 --- a/database/migrations/2024_08_11_023807_create_branches_table.php +++ b/database/migrations/2024_08_11_023807_create_branches_table.php @@ -1,39 +1,39 @@ id(); - $table->string('code', 9)->unique(); - $table->string('name'); - $table->boolean('status')->default(true)->nullable(); - $table->timestamps(); - $table->timestamp('authorized_at')->nullable(); - $table->char('authorized_status', 1)->nullable(); - $table->softDeletes(); +return new class extends Migration { + /** + * Run the migrations. + */ + public function up(): void + { + Schema::create('branches', function (Blueprint $table) { + $table->id(); + $table->string('code', 9)->unique(); + $table->string('name'); + $table->boolean('status')->default(true)->nullable(); + $table->timestamps(); + $table->timestamp('authorized_at')->nullable(); + $table->char('authorized_status', 1)->nullable(); + $table->softDeletes(); - $table->unsignedBigInteger('created_by')->nullable(); - $table->unsignedBigInteger('updated_by')->nullable(); - $table->unsignedBigInteger('deleted_by')->nullable(); - $table->unsignedBigInteger('authorized_by')->nullable(); - }); - } + $table->unsignedBigInteger('created_by')->nullable(); + $table->unsignedBigInteger('updated_by')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + }); + } - /** - * Reverse the migrations. - */ - public function down() - : void - { - Schema::dropIfExists('branches'); - } - }; + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::disableForeignKeyConstraints(); + Schema::dropIfExists('branches'); + Schema::enableForeignKeyConstraints(); + } +}; diff --git a/database/seeders/BranchesSeeder.php b/database/seeders/BranchesSeeder.php index f3b7341..3f98eaa 100644 --- a/database/seeders/BranchesSeeder.php +++ b/database/seeders/BranchesSeeder.php @@ -186,7 +186,7 @@ class BranchesSeeder extends Seeder ], [ 'code' => 'ID0010031', - 'name' => 'BKR Bandung - KCP', + 'name' => 'BKR BANDUNG - KCP', 'status' => true, 'created_at' => $now, 'updated_at' => $now @@ -319,7 +319,7 @@ class BranchesSeeder extends Seeder ], [ 'code' => 'ID0010063', - 'name' => 'Diponegoro Denpasar KK', + 'name' => 'DIPONEGORO DENPASAR KK', 'status' => true, 'created_at' => $now, 'updated_at' => $now @@ -704,7 +704,7 @@ class BranchesSeeder extends Seeder ], [ 'code' => 'ID0010272', - 'name' => 'Setiabudi Kuningan KK', + 'name' => 'SETIABUDI KUNINGAN KK', 'status' => true, 'created_at' => $now, 'updated_at' => $now