Browse Source

Update: menambahkan data API Show pengembalian barang

master
unknown 1 year ago
parent
commit
b6747f7f88
  1. 20
      app/Http/Controllers/API/v1/PengembalianApi/PengembalianBarangApiController.php
  2. 3
      routes/api.php

20
app/Http/Controllers/API/v1/PengembalianApi/PengembalianBarangApiController.php

@ -25,6 +25,26 @@ class PengembalianBarangApiController extends Controller
]);
}
public function show($id)
{
$pengembalian = \App\Models\asset_status::with([
'peti.customer:id,name,code_customer,lot_no,nip,no_hp,tgl_lahir,jenis_kelamin,agama,address',
'peti.tipe_peti:id,type,size_peti,description',
'warehouse',
'warehouseEnter'
])->find($id);
if (!$pengembalian) {
return ResponseFormatter::error([
'message' => 'Data pengembalian tidak ditemukan',
], 'Data Not Found', 404);
}
return ResponseFormatter::success([
'message' => 'Data pengembalian berhasil diambil',
'asset_status' => $pengembalian,
]);
}
public function update(Request $request, $id)
{

3
routes/api.php

@ -27,10 +27,11 @@ Route::prefix('v1')->group(function () {
Route::get('/asset-status', [App\Http\Controllers\API\v1\PeminjamanApi\PeminjamanApiController::class, 'index'])->name('peminjaman-barang');
Route::post('/asset-status/store', [App\Http\Controllers\API\v1\PeminjamanApi\PeminjamanApiController::class, 'store'])->name('peminjaman-barang.store');
Route::get('/asset-status/show/{id}', [App\Http\Controllers\API\v1\PeminjamanApi\PeminjamanApiController::class, 'show'])->name('peminjaman-barang.show');
Route::get('/asset-status/peminjaman/show/{id}', [App\Http\Controllers\API\v1\PeminjamanApi\PeminjamanApiController::class, 'show'])->name('peminjaman-barang.show');
Route::get('/asset-status/pengembalian', [App\Http\Controllers\API\v1\PengembalianApi\PengembalianBarangApiController::class, 'index'])->name('pengembalian-barang');
Route::put('/asset-status/update/{id}', [App\Http\Controllers\API\v1\PengembalianApi\PengembalianBarangApiController::class, 'update'])->name('pengembalian-barang.update');
Route::get('/asset-status/pengembalian/show/{id}', [App\Http\Controllers\API\v1\PengembalianApi\PengembalianBarangApiController::class, 'show'])->name('pengembalian-barang.show');
Route::get('/peti-asset', [App\Http\Controllers\API\v1\AssetStatusApi\AssetStatusApiController::class, 'index'])->name('peti.barang');

Loading…
Cancel
Save