added api for po issue remark

This commit is contained in:
Aqqil Azman
2024-07-25 11:27:21 +08:00
parent 6123bb5285
commit 5b88b0ee2e
+29
View File
@@ -138,4 +138,33 @@ Route::group(['prefix' => 'admin-work-flow', 'as' => 'admin_work_flow.', 'namesp
return jsonResponse($remark, 'Remark created successfully', 201);
})->name('create_1688_login_issue_remark');
Route::post('/create_approve_issue_remark', function (Request $request) {
$validator = Validator::make($request->all(), [
'booking_id' => 'required',
'remark' => 'required',
'user_id' => 'required',
]);
if ($validator->fails()) {
throw new RequestValidationException($validator->messages()->first());
}
$booking = Booking::find($request->booking_id);
if (!$booking) {
return jsonResponse(null, 'Booking not found', 404);
}
$remark = new Remark([
'commenter_id' => $request->user_id,
'content' => $request->remark,
'owner_type' => get_class($booking),
'owner_id' => $booking->id,
]);
$remark->save();
return jsonResponse($remark, 'Remark created successfully', 201);
})->name('create_approve_issue_remark');
});