Update Module User

- Add Nik and branch,
This commit is contained in:
Daeng Deni Mardaeni
2024-08-27 14:45:50 +07:00
parent 18f0f68f1a
commit d3baaa31c1
8 changed files with 121 additions and 15 deletions

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Modules\Lpj\Models\Branch;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
$table->string('nik')->nullable()->after('email');
$table->foreignIdFor(Branch::class)->nullable()->after('nik')->constrained('branches');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('nik');
$table->dropForeign(['branch_id']);
$table->dropColumn('branch_id');
});
}
};