| 1234567891011121314151617181920 |
- <?php
- namespace App\Exceptions;
- use Illuminate\Http\JsonResponse;
- use Illuminate\Http\Request;
- use RuntimeException;
- class BankAccountException extends RuntimeException
- {
- public function __construct(string $messageKey, private readonly int $status = 422)
- {
- parent::__construct(__("messages.{$messageKey}"));
- }
- public function render(Request $request): JsonResponse
- {
- return response()->json(['payload' => null, 'message' => $this->getMessage()], $this->status);
- }
- }
|