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:
@@ -4,7 +4,9 @@
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\VehicleItem;
|
||||
use App\Models\MasterTarif;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class MasterVehicleController extends Controller
|
||||
{
|
||||
@@ -40,7 +42,38 @@ public function create()
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
$request->merge([
|
||||
'id' => strtoupper((string) $request->input('id')),
|
||||
'short_cut' => strtoupper((string) $request->input('short_cut')),
|
||||
]);
|
||||
|
||||
$data = $request->validate([
|
||||
'id' => 'required|string|max:16|alpha_num|unique:jenis_mobil,id',
|
||||
'nama' => 'required|string|max:100',
|
||||
'short_cut' => 'required|string|max:16',
|
||||
'tarif' => 'required|numeric|min:0',
|
||||
]);
|
||||
|
||||
$vehicle = DB::transaction(function () use ($data) {
|
||||
$vehicle = VehicleItem::create([
|
||||
'id' => strtoupper($data['id']),
|
||||
'nama' => $data['nama'],
|
||||
'short_cut' => strtoupper($data['short_cut']),
|
||||
'tanggal' => now(),
|
||||
'orang' => 0,
|
||||
'validasi' => 0,
|
||||
]);
|
||||
|
||||
MasterTarif::create([
|
||||
'id_mobil' => $vehicle->id,
|
||||
'tarif' => $data['tarif'],
|
||||
'tanggal' => now(),
|
||||
]);
|
||||
|
||||
return $vehicle;
|
||||
});
|
||||
|
||||
return response()->json(['success' => true, 'message' => 'Jenis kendaraan dan tarif awal berhasil ditambahkan.', 'data' => $vehicle], 201);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -51,7 +84,10 @@ public function store(Request $request)
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
$vehicle = VehicleItem::findOrFail($id);
|
||||
$tarif = MasterTarif::find($id);
|
||||
|
||||
return response()->json(['success' => true, 'data' => $vehicle, 'tarif' => $tarif]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,7 +98,7 @@ public function show($id)
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
return response()->json(['success' => true, 'data' => VehicleItem::findOrFail($id)]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,7 +110,18 @@ public function edit($id)
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
$data = $request->validate([
|
||||
'nama' => 'required|string|max:100',
|
||||
'short_cut' => 'required|string|max:16',
|
||||
]);
|
||||
|
||||
$vehicle = VehicleItem::findOrFail($id);
|
||||
$vehicle->update([
|
||||
'nama' => $data['nama'],
|
||||
'short_cut' => strtoupper($data['short_cut']),
|
||||
]);
|
||||
|
||||
return response()->json(['success' => true, 'message' => 'Jenis kendaraan berhasil diperbarui.', 'data' => $vehicle]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -85,6 +132,11 @@ public function update(Request $request, $id)
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
DB::transaction(function () use ($id) {
|
||||
MasterTarif::where('id_mobil', $id)->delete();
|
||||
VehicleItem::findOrFail($id)->delete();
|
||||
});
|
||||
|
||||
return response()->json(['success' => true, 'message' => 'Jenis kendaraan dan tarif terkait berhasil dihapus.']);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user