Skip to content

Commit

Permalink
📄 translation parameter support
Browse files Browse the repository at this point in the history
  • Loading branch information
acidjazz committed Sep 27, 2018
1 parent 991849e commit ceda32e
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/MetApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,30 +156,31 @@ protected function addError($type,$message,$file=null,$line=null)
* returns $this->errors w/ no view, transformer and an error code of 500
*/

protected function error($key='unknown') {
protected function error($key='unknown',$replace=[]) {

if ($key !== 'unknown' || count($this->errors) < 1) {
$this->addError($key, __($key));
$this->addError($key, __($key,$replace));
}

$this->render(['errors' => $this->errors], false, 500);
$this->render(['errors' => $this->errors], 500);
}

/**
* render errors and abort
*/
protected function abort() {
$this->render(['errors' => $this->errors], false, 500, true);
$this->render(['errors' => $this->errors], 500, true);
}

/**
* Render success
* @param string
* @param String
* @param Array
* @return \Illuminate\Http\Response
*/
protected function success($message='Successful')
protected function success($message='Successful',$replace=[])
{
return $this->render(['success' => true,'type' => 'success', 'message' => __($message)]);
return $this->render(['success' => true,'type' => 'success', 'message' => __($message,$replace)], 200, true);
}

/**
Expand Down

0 comments on commit ceda32e

Please sign in to comment.