added new migrations and models

This commit is contained in:
Jagad R R
2024-12-11 12:29:37 +07:00
parent 0168f5b32f
commit fc5372a181
21 changed files with 436 additions and 7 deletions
@@ -20,8 +20,10 @@ class CreateUsersTable extends Migration
$table->string('username')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->string('phone');
$table->rememberToken();
$table->timestamps();
$table->softDeletes();
});
}
@@ -22,6 +22,7 @@ class CreateAdminsTable extends Migration
$table->string('password');
$table->rememberToken();
$table->timestamps();
$table->softDeletes();
});
}
@@ -21,6 +21,7 @@ return new class extends Migration
// Foreign key
$table->foreign('user_id')->references('id')->on('admins')->onDelete('cascade');
$table->softDeletes();
});
}
@@ -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::create('rayon', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('rayon');
}
};
@@ -0,0 +1,44 @@
<?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('form_up_country', function (Blueprint $table) {
$table->id();
$table->string('expense_number')->unique();
$table->foreignId('user_id')->constrained('users')->cascadeOnDelete();
$table->foreignId('rayon_id')->constrained('rayon')->cascadeOnDelete();
$table->date('tanggal');
$table->string('tujuan');
$table->integer('jarak');
$table->integer('allowance');
$table->integer('transport_dalkot');
$table->integer('transport_ankot');
$table->integer('hotel');
$table->integer('total');
$table->string('bukti1')->nullable();
$table->string('bukti2')->nullable();
$table->string('bukti3')->nullable();
$table->string('account_number');
$table->string('status');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('form_up_country');
}
};
@@ -0,0 +1,42 @@
<?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('form_vehicle_running_cost', function (Blueprint $table) {
$table->id();
$table->string('expense_number')->unique();
$table->foreignId('user_id')->constrained('users')->cascadeOnDelete();
$table->dateTime('tanggal');
$table->integer('liter');
$table->integer('harga');
$table->integer('jarak');
$table->string('tipe_bensin');
$table->string('nopol');
$table->text('keterangan');
$table->string('bukti1')->nullable();
$table->string('bukti2')->nullable();
$table->string('bukti3')->nullable();
$table->string('account_number');
$table->string('status');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('form_vehicle_running_cost');
}
};
@@ -0,0 +1,42 @@
<?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('form_entertainment_presentation', function (Blueprint $table) {
$table->id();
$table->string('expense_number')->unique();
$table->foreignId('user_id')->constrained('users')->cascadeOnDelete();
$table->date('tanggal');
$table->string('jenis');
$table->text('keterangan');
$table->integer('total');
$table->string('name');
$table->string('alamat');
$table->string('nik_or_npwp');
$table->string('bukti1')->nullable();
$table->string('bukti2')->nullable();
$table->string('bukti3')->nullable();
$table->string('account_number');
$table->string('status');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('form_entertainment_presentation');
}
};
@@ -0,0 +1,39 @@
<?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('form_meeting_seminar', function (Blueprint $table) {
$table->id();
$table->string('expense_number')->unique();
$table->foreignId('user_id')->constrained('users')->cascadeOnDelete();
$table->integer('allowance');
$table->integer('transport_ankot');
$table->integer('hotel');
$table->integer('total');
$table->string('bukti1')->nullable();
$table->string('bukti2')->nullable();
$table->string('bukti3')->nullable();
$table->string('account_number');
$table->string('status');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('form_meeting_seminar');
}
};
@@ -0,0 +1,30 @@
<?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('kategori', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('account_number');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('kategori');
}
};
@@ -0,0 +1,38 @@
<?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('form_others', function (Blueprint $table) {
$table->id();
$table->string('expense_number')->unique();
$table->foreignId('user_id')->constrained('users')->cascadeOnDelete();
$table->foreignId('kategori_id')->constrained('kategori')->cascadeOnDelete();
$table->date('tanggal');
$table->text('keterangan');
$table->integer('total');
$table->string('bukti1')->nullable();
$table->string('bukti2')->nullable();
$table->string('bukti3')->nullable();
$table->string('status')->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('form_others');
}
};
@@ -0,0 +1,30 @@
<?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('region', function (Blueprint $table) {
$table->id();
$table->string('code');
$table->string('name');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('region');
}
};
@@ -0,0 +1,30 @@
<?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('cost_centre', function (Blueprint $table) {
$table->id();
$table->string('code');
$table->string('name');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('cost_centre');
}
};
@@ -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
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('cabang', function (Blueprint $table) {
$table->id();
$table->foreignId('region_id')->constrained('region')->onDelete('cascade');
$table->foreignId('cost_id')->constrained('cost_centre')->onDelete('cascade');
$table->string('code');
$table->string('name');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('cabang');
}
};
@@ -0,0 +1,30 @@
<?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('user_has_cabang', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained('users')->cascadeOnDelete();
$table->foreignId('cabang_id')->constrained('cabang')->cascadeOnDelete();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('user_has_cabang');
}
};
@@ -0,0 +1,34 @@
<?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('audit_trail', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained('users')->cascadeOnDelete();
$table->string('ip_address');
$table->string('activity')->nullable();
$table->string('action')->nullable();
$table->text('user_agent')->nullable();
$table->string('browser')->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('audit_trail');
}
};