chore: update composer dependencies to include phppresentation chore: update composer.lock after adding phppresentation feat: create categories migration for category management feat: create templates migration for template storage feat: create template generations migration for tracking template usage feat: create template keys migration for template customization feat: create notifications migration for user notifications feat: update API routes for categories, templates, and user profile management docs: update API documentation to include new endpoints for profile and wallet
25 lines
552 B
PHP
25 lines
552 B
PHP
<?php
|
|
|
|
namespace App\Traits;
|
|
|
|
use Illuminate\Http\JsonResponse;
|
|
|
|
trait ApiResponse
|
|
{
|
|
protected function success(string $message, array $data = [], int $status = 200): JsonResponse
|
|
{
|
|
return response()->json([
|
|
'message' => $message,
|
|
'data' => $data,
|
|
], $status);
|
|
}
|
|
|
|
protected function error(string $message, array $errors = [], int $status = 422): JsonResponse
|
|
{
|
|
return response()->json([
|
|
'message' => $message,
|
|
'errors' => $errors,
|
|
], $status);
|
|
}
|
|
}
|