Rapihin setup/member/lot-parking + fitur intercom, exclude WIP controller & file sampah dari git
Kumpulan perubahan yang udah numpuk di working tree: refactor Setup (Gate/Vehicle/Member), rapihin memberin & stiker, service parking baru (ParkingUtilsServices, NetworkService), model/migration lot-parking & DHCP reservation, dan fitur baru Intercom (controller/model/migration/ view). ReportTransaksiController versi lokal ini WIP (~90%, masih didebug) - versi yang bener ada di server, jadi dikeluarin dari git (ditambahin ke .gitignore) biar gak numpuk nindihin punya server pas git pull di sana. Sekalian keluarin dump mentah tabel softseting (1.8MB, nyasar ke-commit), file .bak, dan arsip ad-hoc (api.tgz, c.zip) yang emang bukan source code. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EAJc2mrpj2cSTe4oowLPzQ
This commit is contained in:
@@ -11,18 +11,31 @@ class SetupController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$status = [
|
||||
'pgcrypto' => $this->checkPgcrypto(),
|
||||
'pegawai_columns' => $this->checkPegawaiColumns(),
|
||||
'users_view' => $this->checkUsersView(),
|
||||
'veri_time' => Schema::hasColumn('transaksi_parkir', 'veri_time'),
|
||||
];
|
||||
$status = $this->status();
|
||||
|
||||
return view('welcome', compact('status'));
|
||||
return view('welcome', ['isReady' => $this->isReady($status)]);
|
||||
}
|
||||
|
||||
public function setup()
|
||||
{
|
||||
$status = $this->status();
|
||||
|
||||
if ($this->isReady($status)) {
|
||||
return redirect()->route('login');
|
||||
}
|
||||
|
||||
return view('setup', compact('status'));
|
||||
}
|
||||
|
||||
public function run()
|
||||
{
|
||||
if ($this->isReady($this->status())) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Setup database sudah selesai dan tidak perlu dijalankan ulang.',
|
||||
], 403);
|
||||
}
|
||||
|
||||
DB::beginTransaction();
|
||||
|
||||
try {
|
||||
@@ -66,6 +79,18 @@ public function run()
|
||||
});
|
||||
}
|
||||
|
||||
// 5. Laravel database sessions for authenticated web requests.
|
||||
if (!Schema::hasTable('sessions')) {
|
||||
Schema::create('sessions', function ($table) {
|
||||
$table->string('id')->primary();
|
||||
$table->unsignedBigInteger('user_id')->nullable()->index();
|
||||
$table->string('ip_address', 45)->nullable();
|
||||
$table->text('user_agent')->nullable();
|
||||
$table->longText('payload');
|
||||
$table->integer('last_activity')->index();
|
||||
});
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
|
||||
// return redirect()->back()->with('success', 'Setup berhasil dijalankan ✅');
|
||||
@@ -84,6 +109,26 @@ public function run()
|
||||
}
|
||||
}
|
||||
|
||||
private function status(): array
|
||||
{
|
||||
return [
|
||||
'pgcrypto' => $this->checkPgcrypto(),
|
||||
'pegawai_columns' => $this->checkPegawaiColumns(),
|
||||
'users_view' => $this->checkUsersView(),
|
||||
'veri_time' => Schema::hasColumn('transaksi_parkir', 'veri_time'),
|
||||
'sessions' => Schema::hasTable('sessions'),
|
||||
];
|
||||
}
|
||||
|
||||
private function isReady(array $status): bool
|
||||
{
|
||||
return $status['pgcrypto']
|
||||
&& $status['users_view']
|
||||
&& $status['veri_time']
|
||||
&& $status['sessions']
|
||||
&& !in_array(false, $status['pegawai_columns'], true);
|
||||
}
|
||||
|
||||
/* =========================
|
||||
Helper
|
||||
========================= */
|
||||
|
||||
Reference in New Issue
Block a user