change response json
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Helpers;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Carbon\CarbonPeriod;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class Helper
|
||||
@@ -144,12 +145,20 @@ class Helper
|
||||
return (object) $schedules;
|
||||
}
|
||||
|
||||
public static function currencyIdrFormat($price)
|
||||
public static function currencyIdrFormat(int $price)
|
||||
{
|
||||
return "Rp. " . number_format($price, 0, ',', '.');
|
||||
}
|
||||
|
||||
public static function responseJson($data = [], $statusCode = Response::HTTP_OK, $message = 'Data berhasil di ambil')
|
||||
/**
|
||||
* Helper Response Json.
|
||||
*
|
||||
* @param array|object $data
|
||||
* @param int $statusCode
|
||||
* @param string $message
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public static function responseJson(array|object $data = [], int $statusCode = Response::HTTP_OK, string $message = 'Data berhasil di ambil'): JsonResponse
|
||||
{
|
||||
return response()->json([
|
||||
'status' => $statusCode != 200 ? 'error' : 'success',
|
||||
|
||||
Reference in New Issue
Block a user