init title lokasi, dan penambahan api
This commit is contained in:
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\TransaksiParkir;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class ParkingOperationController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$transaksi = $this->show($request->input('transaksi'))->getData();
|
||||
|
||||
// dd($transaksi)->status;
|
||||
// dd($transaksi->getData());
|
||||
Log::info(get_class($transaksi));
|
||||
dd(get_class($transaksi));
|
||||
// if ($transaksi->status === true && $transaksi->member === false) {
|
||||
// }
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$transaksi = TransaksiParkir::where('no_pol','LIKE', '%' .$id . '%')->first();
|
||||
|
||||
if (!$transaksi) {
|
||||
return response()->json([
|
||||
'status' => false,
|
||||
'message' => 'Kendaraan belum masuk atau transaksi tidak ditemukan'
|
||||
]);
|
||||
}
|
||||
|
||||
$isMember = $transaksi->status_transaksi == '3' ? true : false;
|
||||
|
||||
return response()->json([
|
||||
'status' => true,
|
||||
'member' => $isMember,
|
||||
'data' => [
|
||||
'id' => $transaksi->id,
|
||||
'no_pol' => $transaksi->no_pol,
|
||||
'id_kendaraan' => $transaksi->id_mobil,
|
||||
'waktu_masuk' => $transaksi->waktu_masuk,
|
||||
'status' => $transaksi->status,
|
||||
'status_transaksi' => $transaksi->status_transaksi
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -62,7 +62,7 @@ public function show($id)
|
||||
// } else (
|
||||
// $condition = where('no_pol', $id);
|
||||
// )
|
||||
// $vehicle = JenisMobil::all();
|
||||
// $vehicle = VehicleItem::all();
|
||||
// $data = TransaksiParkir::select('no_pol','waktu_masuk','waktu_keluar','jm.nama as vehicle','id_kendaraan','np.nama as gateIn', 'id_pintu_masuk','jm.nama as vehiclename')
|
||||
// ->leftJoin('jenis_mobil as jm', 'jm.id', '=', 'transaksi_parkir.id_kendaraan')
|
||||
// ->leftJoin('nama_pos as np', 'np.id', '=', 'transaksi_parkir.id_pintu_masuk')
|
||||
@@ -76,7 +76,7 @@ public function show($id)
|
||||
// ]);
|
||||
Log::info('ID: ' . $id);
|
||||
|
||||
$vehicle = JenisMobil::all();
|
||||
$vehicle = VehicleItem::all();
|
||||
|
||||
$query = TransaksiParkir::select(
|
||||
'no_pol',
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Http\Setup\Vehicle;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\VehicleItem;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class MasterVehicleController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$vehicle = VehicleItem::orderBy('id')->get();
|
||||
|
||||
// dd($vehicle);
|
||||
|
||||
return view ('setup.vehicle.vehicle', compact('vehicle'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Http\Setup\Vehicle;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\MasterTarif;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class ModifiedVehiclepriceController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
// Log::info($id);
|
||||
$id = str($id);
|
||||
$vehicleRates = DB::table('tarif')->where('id_mobil', $id)->first();
|
||||
|
||||
Log::info(json_encode($vehicleRates));
|
||||
return $vehicleRates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
// Log::info($request->all());
|
||||
// $id = $request->id_mobil;
|
||||
|
||||
$dataQuery = MasterTarif::find($id);
|
||||
try {
|
||||
|
||||
Log::info($request->all());
|
||||
|
||||
$dataQuery->fill($request->all());
|
||||
|
||||
if (! $dataQuery->isDirty()) {
|
||||
// if($dataQuery->isDirty()) {
|
||||
return response()->json([
|
||||
'status' => false,
|
||||
'message' => 'Tidak ada perubahan data'
|
||||
]);
|
||||
// }
|
||||
|
||||
}
|
||||
Log::info('Data yang di simpan' . json_encode($dataQuery->getDirty()));
|
||||
$dataQuery->save();
|
||||
|
||||
return response()->json([
|
||||
'status' => true,
|
||||
'message' => 'Data berhasil di ubah'
|
||||
]);
|
||||
} catch (\Throwable $th) {
|
||||
//throw $th;
|
||||
Log::info('Data yang di simpan' . json_encode($dataQuery->getDirty()));
|
||||
|
||||
// Log::info($request->all());
|
||||
|
||||
return response()->json([
|
||||
'status' => false,
|
||||
'message' => 'Gagal menyimpan data ' . $th->getMessage(),
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user