migrate to gtea from bistbucket

This commit is contained in:
2026-03-15 17:08:23 +07:00
commit 129ca2260c
3716 changed files with 566316 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
<?php
namespace App\Traits;
use Illuminate\Http\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
trait ResponseTrait
{
/**
* Success response.
*
* @param object|array $data
*/
public function responseSuccess($data, string $message = 'Successful'): JsonResponse
{
return response()->json([
'status' => true,
'message' => $message,
'data' => $data,
'errors' => null,
], Response::HTTP_OK);
}
/**
* Error response.
*
* @param array|object $errors
*/
public function responseError(
$errors,
string $message = 'Something went wrong.',
int $responseCode = Response::HTTP_INTERNAL_SERVER_ERROR
): JsonResponse {
return response()->json([
'status' => false,
'message' => $message,
'data' => null,
'errors' => $errors,
], $responseCode);
}
}