Laravel Vapor - Fix an error in code that causes deployment fail

This commit is contained in:
Dillon Ngo
2024-10-15 02:30:52 +08:00
parent c03df14827
commit 0a4980077e
+22 -10
View File
@@ -16,18 +16,30 @@ use Illuminate\Http\JsonResponse;
Route::group(['prefix' => 'admin-work-flow', 'as' => 'admin_work_flow.', 'namespace' => 'AdminWorkFlow'], function () {
// Generalized JSON response function
function jsonResponse($data = null, $message = null, $status = 200)
{
$response = ['message' => $message];
// function jsonResponse($data = null, $message = null, $status = 200)
// {
// $response = ['message' => $message];
if ($data !== null) {
$response['data'] = $data;
// if ($data !== null) {
// $response['data'] = $data;
// }
// return response()->json($response, $status);
// }
if (!function_exists('jsonResponse')) {
function jsonResponse($data = null, $message = null, $status = 200)
{
$response = ['message' => $message];
if ($data !== null) {
$response['data'] = $data;
}
return response()->json($response, $status);
}
return response()->json($response, $status);
}
Route::get('/fetch-oldest-order', function () {
$booking = Booking::where('service_id', 4)
->where('status', ApprovalStatus::APPROVED)
@@ -147,9 +159,9 @@ Route::group(['prefix' => 'admin-work-flow', 'as' => 'admin_work_flow.', 'namesp
if ($validator->fails()) {
throw new RequestValidationException($validator->messages()->first());
}
$booking = Booking::find($request->booking_id);
if (!$booking) {
return jsonResponse(null, 'Booking not found', 404);