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:
@@ -5,7 +5,6 @@
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\ConfigHardware;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class MasterGateHardwareController extends Controller
|
||||
{
|
||||
@@ -48,9 +47,11 @@ public function store(Request $request)
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
Log::info($id);
|
||||
// # ambil konfigurasi hardware berdasarkan id_pos (id pintu)
|
||||
$gateDetails = ConfigHardware::where('id_pos', $id)->first();
|
||||
return $gateDetails;
|
||||
|
||||
// # kalau belum ada datanya, kembalikan objek kosong biar form tetap kebuka
|
||||
return response()->json($gateDetails ?? (object) []);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,8 +74,26 @@ public function edit($id)
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
Log::info($id);
|
||||
Log::info($request->all());
|
||||
// # hanya kolom yang terdaftar di fillable yang boleh disimpan
|
||||
$allowed = (new ConfigHardware())->getFillable();
|
||||
$data = $request->input('data', []);
|
||||
|
||||
$filtered = [];
|
||||
foreach ((array) $data as $key => $value) {
|
||||
if (in_array($key, $allowed, true)) {
|
||||
// # ubah string kosong jadi null biar cocok dengan kolom integer
|
||||
$filtered[$key] = $value === '' ? null : $value;
|
||||
}
|
||||
}
|
||||
|
||||
// # simpan (buat baru kalau id_pos belum punya baris hardware)
|
||||
$hardware = ConfigHardware::updateOrCreate(['id_pos' => $id], $filtered);
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => 'Konfigurasi hardware berhasil disimpan.',
|
||||
'data' => $hardware,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user