mirror of
https://gitlab.com/izyim/prototypes/lumen-microservices/microservice-products-api.git
synced 2026-08-19 12:24:17 +00:00
19 lines
414 B
PHP
19 lines
414 B
PHP
<?php
|
|
|
|
namespace App\Traits;
|
|
|
|
use Illuminate\Http\Response;
|
|
|
|
trait ApiResponse
|
|
{
|
|
|
|
public function successResponse($data, $statusCode = Response::HTTP_OK)
|
|
{
|
|
return response()->json(['data' => $data], $statusCode);
|
|
}
|
|
|
|
public function errorResponse($errorMessage, $statusCode)
|
|
{
|
|
return response()->json(['error' => $errorMessage, 'error_code' => $statusCode], $statusCode);
|
|
}
|
|
} |