0👍
Just return response like this
return response()->json(['response' => ['status' => true, 'data' => $apiResponse]], JsonResponse::HTTP_OK);
HTTP_OK =200 and its a enum type of use Illuminate\Http\JsonResponse;
status =true mean you returning the data .
for example if your data is empty then return something like this
return response()->json(['response' => ['status' => false, 'message' => 'Unable to find data ']], JsonResponse::HTTP_BAD_REQUEST);
just return this .
return response()->json($data, JsonResponse::HTTP_OK);
hope this will hel you
- [Vuejs]-How to share data between pages Vue in non single page
- [Vuejs]-Pass row.item.attribute value to a modal with Bootstrap Vuejs
Source:stackexchange.com