opensupports/server/models/Response.php

27 lines
679 B
PHP
Raw Normal View History

<?php
2015-11-19 01:57:59 +01:00
class Response {
public static function respondError($errorMsg, $data = null) {
$response = array(
'status' => 'fail',
'message' => $errorMsg,
'data' => $data
);
$app = \Slim\Slim::getInstance();
$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()->setBody(json_encode($response));
$app->response()->finalize();
}
}