You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.0 KiB
41 lines
1.0 KiB
<?php |
|
|
|
namespace App\Http\Controllers\API\v1\PeminjamanApi; |
|
|
|
use Illuminate\Http\Request; |
|
use App\Helpers\ResponseFormatter; |
|
use App\Http\Controllers\Controller; |
|
use App\Models\asset_status; |
|
use App\Models\BarangMasuk; |
|
|
|
class PeminjamanApiController extends Controller |
|
{ |
|
public function index() |
|
{ |
|
$peminjaman = \App\Models\asset_status::with(['asset', 'warehouse'])->get(); |
|
|
|
return ResponseFormatter::success([ |
|
'message' => 'Data peminjaman berhasil diambil', |
|
'peminjam' => $peminjaman |
|
]); |
|
} |
|
|
|
public function store(Request $request) |
|
{ |
|
$this->validate($request, [ |
|
'asset_id' => 'required', |
|
'exit_at' => 'required', |
|
'exit_pic' => 'required', |
|
'exit_warehouse' => 'required', |
|
]); |
|
|
|
$data = $request->all(); |
|
|
|
$peminjaman = asset_status::create($data); |
|
|
|
return ResponseFormatter::success([ |
|
'message' => 'Data peminjaman berhasil ditambahkan', |
|
'peminjam' => $peminjaman |
|
]); |
|
} |
|
}
|
|
|