From e38322869b18232d03c571d83c8e77fec1e5064e Mon Sep 17 00:00:00 2001 From: kevin olson Date: Sun, 18 Apr 2021 16:57:41 -0500 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20add=20a=20warn=20helper=20that=20gi?= =?UTF-8?q?ves=20a=20200=20but=20type=20is=20warning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MetApi.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/MetApi.php b/src/MetApi.php index 600e058..72f812d 100644 --- a/src/MetApi.php +++ b/src/MetApi.php @@ -255,7 +255,8 @@ public function abort() /** * Render success * @param string - * @param array + * @param array $replace + * @param array $data * @return mixed */ public function success($message = 'Successful', $replace = [], $data = []) @@ -268,6 +269,24 @@ public function success($message = 'Successful', $replace = [], $data = []) ], 200, true); } + /** + * Render success + * @param string + * @param array $replace + * @param array $data + * @return mixed + */ + public function warn($message = 'Warning', $replace = [], $data = []) + { + return $this->render([ + 'success' => false, + 'type' => 'warning', + 'message' => __($message, $replace), + 'data' => $data, + ], 200, true); + } + + /** * Final output * @param mixed $data data to be sent