Finished applications API endpoint group

This commit is contained in:
2021-03-31 19:39:42 +01:00
parent f267da3760
commit f62ea9669b
3 changed files with 146 additions and 35 deletions

View File

@@ -10,7 +10,7 @@ namespace App\Helpers;
class JSON
{
protected $type, $status, $message, $code, $data;
protected $type, $status, $message, $code, $data, $additional;
/**
* @param mixed $type
@@ -21,6 +21,23 @@ class JSON
return $this;
}
/**
* @param mixed $additional
*/
public function setAdditional($additional)
{
$this->additional = $additional;
return $this;
}
/**
* @return mixed
*/
public function getAdditional()
{
return $this->additional;
}
/**
* @return mixed
*/
@@ -109,9 +126,16 @@ class JSON
'meta' => [
'status' => $this->getStatus(),
'message' => $this->getMessage(),
],
]
];
if (!empty($this->additional))
{
foreach($this->additional as $additionalKeyName => $key)
{
$response[$additionalKeyName] = $key;
}
}
return response($response, $this->getCode(), $headers);
}