+ protected function jsonError(string $messageText = '', int $statusCode = 500): JsonResponse
+ {
+ return response()->json(['message' => $messageText, 'status' => 'error'], $statusCode);
+ }
+
+ /**
+ * Create a response that forces a download in the browser.
+ */
+ protected function downloadResponse(string $content, string $fileName): Response
+ {
+ return response()->make($content, 200, [
+ 'Content-Type' => 'application/octet-stream',
+ 'Content-Disposition' => 'attachment; filename="' . $fileName . '"',
+ 'X-Content-Type-Options' => 'nosniff',
+ ]);
+ }
+
+ /**
+ * Create a file download response that provides the file with a content-type
+ * correct for the file, in a way so the browser can show the content in browser.
+ */
+ protected function inlineDownloadResponse(string $content, string $fileName): Response