This commit is contained in:
Meghdad committed 2026-08-24 19:44:24 +03:30
commit 8d5446f466
232 files changed
+25416

No files matched your search

@@ -0,0 +1,27 @@
<?php
namespace App\Services\CafeBazaar;
use Illuminate\Http\JsonResponse;
class BazaarResponse
{
public function __construct(
public readonly int $status,
public readonly array $body,
) {}
public function successful(): bool
{
return $this->status >= 200 && $this->status < 300;
}
public function toJsonResponse(): JsonResponse
{
return response()->json([
'data' => $this->successful() ? $this->body : null,
'error' => $this->successful() ? null : $this->body,
'meta' => ['bazaar_status' => $this->status],
], $this->status);
}
}