mirror of
https://github.com/opensupports/opensupports.git
synced 2025-09-27 03:49:09 +02:00
29 lines
819 B
PHP
Executable File
29 lines
819 B
PHP
Executable File
<?php
|
|
class Response {
|
|
|
|
public static function respondError($errorMsg, $data = null) {
|
|
$response = array(
|
|
'status' => 'fail',
|
|
'message' => $errorMsg,
|
|
'data' => $data
|
|
);
|
|
|
|
$app = \Slim\Slim::getInstance();
|
|
$app->response->headers->set('Content-Type', 'application/json');
|
|
$app->response->setBody(json_encode($response));
|
|
$app->response->finalize();
|
|
}
|
|
|
|
public static function respondSuccess($data = null) {
|
|
$response = array(
|
|
'status' => 'success',
|
|
'data' => $data
|
|
);
|
|
|
|
$app = \Slim\Slim::getInstance();
|
|
$app->response->headers->set('Content-Type', 'application/json');
|
|
$app->response->setBody(json_encode($response));
|
|
$app->response->finalize();
|
|
}
|
|
}
|