Files
aso/Modules/HospitalPortal/Helpers/ApiResponse.php
Linksehat Staging Server 70fc1579e7 update
2024-07-12 08:41:18 +07:00

21 lines
615 B
PHP
Executable File

<?php
namespace Modules\HospitalPortal\Helpers;
class ApiResponse
{
public static function apiResponse(string $status, array|object $data = null, string|array|object $message = null, int $statusCode)
{
if ($message instanceof \Illuminate\Support\MessageBag) {
$message = $message->first();
}
return response()->json([
'meta' => [
'status' => $status,
'code' => $statusCode,
'message' => $message
],
'data' => $data,
], $statusCode);
}
}