mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-21 21:43:57 +00:00
changed api route and api name for issue remark
This commit is contained in:
+31
-32
@@ -108,9 +108,37 @@ Route::group(['prefix' => 'admin-work-flow', 'as' => 'admin_work_flow.', 'namesp
|
||||
]);
|
||||
})->name('fetch_model_attributes');
|
||||
|
||||
|
||||
|
||||
Route::post('/create-1688-login-issue-remark', function (Request $request) {
|
||||
// Route::post('/create-1688-login-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_1688_login_issue_remark');
|
||||
|
||||
Route::post('/create_issue_remark', function (Request $request) {
|
||||
$validator = Validator::make($request->all(), [
|
||||
'booking_id' => 'required',
|
||||
'remark' => 'required',
|
||||
@@ -137,34 +165,5 @@ Route::group(['prefix' => 'admin-work-flow', 'as' => 'admin_work_flow.', 'namesp
|
||||
$remark->save();
|
||||
|
||||
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');
|
||||
})->name('create_issue_remark');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user