Update Pendidikan & Pelatihan
This commit is contained in:
@@ -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.');
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
<?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('survey_pelatihan', function (Blueprint $table) {
|
||||
$table->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');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user