You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
604 B
27 lines
604 B
<?php
|
|
|
|
use Illuminate\Http\JsonResponse;
|
|
|
|
function success(array $data, ?string $sign = null, string $msg = 'SUCCESS'): JsonResponse
|
|
{
|
|
return response()->json(
|
|
[
|
|
'code' => 0,
|
|
'msg' => $msg,
|
|
'data' => $data,
|
|
'sign' => $sign
|
|
],
|
|
options: JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE
|
|
);
|
|
}
|
|
|
|
function error(string $msg = 'ERROR'): JsonResponse
|
|
{
|
|
return response()->json(
|
|
[
|
|
'code' => 9999,
|
|
'msg' => $msg,
|
|
],
|
|
options: JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE
|
|
);
|
|
}
|