update api

This commit is contained in:
2026-02-20 17:04:36 +07:00
parent 66c8bb6810
commit 1dfcf9b2f5
22 changed files with 655 additions and 13 deletions
@@ -15,6 +15,7 @@ return new class extends Migration
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->string('role')->nullable();
$table->foreignId('created_by')->nullable()->constrained('users')->onDelete('set null');
$table->foreignId('updated_by')->nullable()->constrained('users')->onDelete('set null');
$table->foreignId('deleted_by')->nullable()->constrained('users')->onDelete('set null');
@@ -22,16 +23,16 @@ return new class extends Migration
$table->softDeletes();
});
Schema::create('user_roles', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->unique()->constrained('users')->onDelete('cascade');
$table->enum('role_name', ['Super Admin', 'Admin', 'Koordinator', 'Penyuluh', 'Pendamping', 'Petani'])->default('Petani');
$table->foreignId('created_by')->nullable()->constrained('users')->onDelete('set null');
$table->foreignId('updated_by')->nullable()->constrained('users')->onDelete('set null');
$table->foreignId('deleted_by')->nullable()->constrained('users')->onDelete('set null');
$table->timestamps();
$table->softDeletes();
});
// Schema::create('user_roles', function (Blueprint $table) {
// $table->id();
// $table->foreignId('user_id')->unique()->constrained('users')->onDelete('cascade');
// $table->enum('role_name', ['Super Admin', 'Admin', 'Koordinator', 'Penyuluh', 'Pendamping', 'Petani'])->default('Petani');
// $table->foreignId('created_by')->nullable()->constrained('users')->onDelete('set null');
// $table->foreignId('updated_by')->nullable()->constrained('users')->onDelete('set null');
// $table->foreignId('deleted_by')->nullable()->constrained('users')->onDelete('set null');
// $table->timestamps();
// $table->softDeletes();
// });
Schema::create('password_reset_tokens', function (Blueprint $table) {
$table->string('email')->primary();
@@ -52,7 +53,7 @@ return new class extends Migration
public function down(): void
{
Schema::dropIfExists('users');
Schema::dropIfExists('user_roles');
// Schema::dropIfExists('user_roles');
Schema::dropIfExists('password_reset_tokens');
Schema::dropIfExists('sessions');
}
@@ -0,0 +1,91 @@
<?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('adat', function (Blueprint $table) {
$table->id();
$table->string('nama')->nullable();
$table->foreignId('desa_kelurahan_id')->nullable()->constrained('master_desa_kelurahan');
$table->foreignId('created_by')->nullable()->constrained('users')->onDelete('set null');
$table->foreignId('updated_by')->nullable()->constrained('users')->onDelete('set null');
$table->foreignId('deleted_by')->nullable()->constrained('users')->onDelete('set null');
$table->timestamps();
$table->softDeletes();
});
Schema::create('keluarga', function (Blueprint $table) {
$table->id();
$table->string('kk')->nullable();
$table->foreignId('adat_id')->nullable()->constrained('adat');
$table->foreignId('desa_kelurahan_id')->nullable()->constrained('master_desa_kelurahan');
$table->string('path_kk', 500)->nullable();
$table->string('file_kk')->nullable();
$table->foreignId('created_by')->nullable()->constrained('users')->onDelete('set null');
$table->foreignId('updated_by')->nullable()->constrained('users')->onDelete('set null');
$table->foreignId('deleted_by')->nullable()->constrained('users')->onDelete('set null');
$table->timestamps();
$table->softDeletes();
});
Schema::create('profiles', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained();
$table->string('role')->nullable();
$table->string('nama');
$table->string('email');
$table->string('telepon')->nullable();
$table->string('alamat')->nullable();
$table->string('kk')->nullable();
$table->string('ktp')->nullable();
$table->foreignId('desa_kelurahan_id')->nullable()->constrained('master_desa_kelurahan');
$table->string('path_kk', 500)->nullable();
$table->string('file_kk')->nullable();
$table->string('path_ktp', 500)->nullable();
$table->string('file_ktp')->nullable();
$table->foreignId('keluarga_id')->nullable()->constrained('keluarga')->onDelete('set null');
$table->foreignId('created_by')->nullable()->constrained('users')->onDelete('set null');
$table->foreignId('updated_by')->nullable()->constrained('users')->onDelete('set null');
$table->foreignId('deleted_by')->nullable()->constrained('users')->onDelete('set null');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('profiles');
Schema::dropIfExists('keluarga');
Schema::dropIfExists('adat');
}
};
@@ -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('master_komoditas', function (Blueprint $table) {
$table->id();
$table->string('nama');
$table->foreignId('created_by')->nullable()->constrained('users')->onDelete('set null');
$table->foreignId('updated_by')->nullable()->constrained('users')->onDelete('set null');
$table->foreignId('deleted_by')->nullable()->constrained('users')->onDelete('set null');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('master_komoditas');
}
};
@@ -0,0 +1,66 @@
<?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('map_lahan', function (Blueprint $table) {
$table->id();
$table->string('nama');
$table->string('status_kepemilikan');
$table->foreignId('profile_id')->constrained('profiles');
$table->foreignId('keluarga_pengelola_id')->nullable()->constrained('keluarga')->onDelete('set null');
$table->foreignId('adat_pemilik_id')->nullable()->constrained('keluarga')->onDelete('set null');
$table->foreignId('desa_kelurahan_id')->nullable()->constrained('master_desa_kelurahan');
$table->text('path')->nullable();
$table->integer('luas_lahan')->nullable();
$table->foreignId('created_by')->nullable()->constrained('users')->onDelete('set null');
$table->foreignId('updated_by')->nullable()->constrained('users')->onDelete('set null');
$table->foreignId('deleted_by')->nullable()->constrained('users')->onDelete('set null');
$table->timestamps();
$table->softDeletes();
});
Schema::create('map_tanaman', function (Blueprint $table) {
$table->id();
$table->string('nama');
$table->foreignId('komoditas_id')->constrained('master_komoditas')->onDelete('set null');
$table->foreignId('profile_id')->constrained('profiles')->onDelete('set null');
$table->foreignId('lahan_id')->constrained('map_lahan')->onDelete('set null');
$table->float('latitude')->nullable();
$table->float('longitude')->nullable();
$table->string('kondisi_tanaman')->nullable();
$table->foreignId('created_by')->nullable()->constrained('users')->onDelete('set null');
$table->foreignId('updated_by')->nullable()->constrained('users')->onDelete('set null');
$table->foreignId('deleted_by')->nullable()->constrained('users')->onDelete('set null');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('map_tanaman');
Schema::dropIfExists('map_lahan');
}
};