Skip to content

Commit

Permalink
update response to be json response
Browse files Browse the repository at this point in the history
  • Loading branch information
3x1io committed Sep 11, 2023
1 parent ca2bfd5 commit 6b6b79a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/Helpers/ApiResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,32 +37,32 @@ public static function data($data, $message =null, $code=200, $meta=[]):JsonResp
* @param $code
* @return Response|Application|ResponseFactory
*/
public static function success($message =null, $code=200):Response|Application|ResponseFactory
public static function success($message =null, $code=200): JsonResponse
{
return response(['status' => true, 'message' => $message ?? __("Done !")],$code);
return response()->json(['status' => true, 'message' => $message ?? __("Done !")],$code);
}

/**
* @return Response|Application|ResponseFactory
*/
public static function bannedMessage():Response|Application|ResponseFactory
public static function bannedMessage(): JsonResponse
{
return response(['status' => false, 'account_status' => 'banned', 'errors' => ['token' => [trans('main.account_is_banned')]]]);
return response()->json(['status' => false, 'account_status' => 'banned', 'errors' => ['token' => [trans('main.account_is_banned')]]]);
}

/**
* @return Response|Application|ResponseFactory
*/
public static function emptyToken(): Response|Application|ResponseFactory
public static function emptyToken(): JsonResponse
{
return response(['status' => false, 'errors' => ['unauthorized'=>['you are unauthorized']]],401);
return response()->json(['status' => false, 'errors' => ['unauthorized'=>['you are unauthorized']]],401);
}

/**
* @return Response|Application|ResponseFactory
*/
public static function emptyTokenHeader(): Response|Application|ResponseFactory
public static function emptyTokenHeader(): JsonResponse
{
return response(['unauthorized'=>['you are unauthorized']],400);
return response()->json(['unauthorized'=>['you are unauthorized']],400);
}
}

0 comments on commit 6b6b79a

Please # to comment.