Skip to content

Commit

Permalink
✨ add a warn helper that gives a 200 but type is warning
Browse files Browse the repository at this point in the history
  • Loading branch information
acidjazz committed Apr 18, 2021
1 parent f36254b commit e383228
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/MetApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [])
Expand All @@ -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
Expand Down

0 comments on commit e383228

Please sign in to comment.