diff --git a/app/Http/Controllers/Web/Konfigurasi/AuthController.php b/app/Http/Controllers/Web/Konfigurasi/AuthController.php index b746d23..6338a40 100644 --- a/app/Http/Controllers/Web/Konfigurasi/AuthController.php +++ b/app/Http/Controllers/Web/Konfigurasi/AuthController.php @@ -34,8 +34,8 @@ class AuthController extends Controller User::create([ 'uid' => (string) Str::uuid(), - 'name' => $request->name, - 'username' => $request->name, + 'name' => $request->username, + 'username' => $request->username, 'email' => $request->email, 'password' => Hash::make($request->password), 'status' => 'pending', diff --git a/app/Http/Controllers/Web/Produktivitas/PendidikanPelatihanController.php b/app/Http/Controllers/Web/Produktivitas/PendidikanPelatihanController.php index 39251f3..18daa53 100644 --- a/app/Http/Controllers/Web/Produktivitas/PendidikanPelatihanController.php +++ b/app/Http/Controllers/Web/Produktivitas/PendidikanPelatihanController.php @@ -72,6 +72,8 @@ class PendidikanPelatihanController extends Controller 'jenis_pelatihan' => $item['jenis_pelatihan'] ?? null, 'penyelenggara' => $item['penyelenggara'] ?? null, 'tahun_pelaksanaan' => $item['tahun'] ?? null, + 'created_by' => auth()->id(), + 'updated_by' => auth()->id(), ]); } @@ -84,6 +86,10 @@ class PendidikanPelatihanController extends Controller abort_unless($surveyPelatihan->petani_id === $petani->id, 404); + $surveyPelatihan->update([ + 'deleted_by' => auth()->id(), + ]); + $surveyPelatihan->delete(); return back()->with('success', 'Riwayat pelatihan berhasil dihapus.'); @@ -144,6 +150,8 @@ class PendidikanPelatihanController extends Controller 'lembaga_penerbit' => $item['lembaga_penerbit'] ?? null, 'tahun_pelaksanaan' => $item['tahun'] ?? null, 'is_aktif' => $item['status_berlaku_sertifikat'] ?? 0, + 'created_by' => auth()->id(), + 'updated_by' => auth()->id(), ]); } @@ -156,6 +164,10 @@ class PendidikanPelatihanController extends Controller abort_unless($surveySertifikasi->petani_id === $petani->id, 404); + $surveySertifikasi->update([ + 'deleted_by' => auth()->id(), + ]); + $surveySertifikasi->delete(); return back()->with('success', 'Sertifikasi berhasil dihapus.'); diff --git a/database/migrations/2026_07_07_161851_create_pelatihan_sertifikasi_table.php b/database/migrations/2026_07_07_161851_create_pelatihan_sertifikasi_table.php new file mode 100644 index 0000000..e7953bd --- /dev/null +++ b/database/migrations/2026_07_07_161851_create_pelatihan_sertifikasi_table.php @@ -0,0 +1,52 @@ +id(); + $table->string('uid')->unique(); + $table->foreignId('petani_id')->nullable()->constrained('petani')->onDelete('set null'); + $table->string('jenis_pelatihan'); + $table->string('penyelenggara'); + $table->integer('tahun_pelaksanaan'); + $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('survey_sertifikasi', function (Blueprint $table) { + $table->id(); + $table->string('uid')->unique(); + $table->foreignId('petani_id')->nullable()->constrained('petani')->onDelete('set null'); + $table->string('jenis_sertifikasi'); + $table->string('lembaga_penerbit'); + $table->integer('tahun_pelaksanaan'); + $table->boolean('is_aktif')->default(false); + $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('pelatihan'); + Schema::dropIfExists('sertifikasi'); + } +};