Add Json Response Helper

This commit is contained in:
R
2022-11-02 21:48:14 +07:00
parent 429dc476e2
commit 9a7f26928f
3 changed files with 15 additions and 4 deletions

View File

@@ -147,4 +147,13 @@ class Helper
{
return "Rp. " . number_format($price, 0, ',', '.');
}
public static function makeJsonResponse($data, $statusCode = 200, $message = "Data berhasil diambil")
{
return response()->json([
'statusCode' => $statusCode,
'message' => $message,
'data' => $data
], $statusCode);
}
}