-
-
Notifications
You must be signed in to change notification settings - Fork 1
Library
Bachtiar Panjaitan edited this page Mar 14, 2023
·
4 revisions
Available methods
-
make(status, message = 'OK', data)
- Make array data into json response
- @param status status code
- @param message message
- @param data data
- @return array
-
setIncludeData(data)
- Append additional data to response
- @param data array data
- @return array
-
setStatusCode(httpStatusCode, withHttpMessage = true)
- Set status code response
- @param data array data
-
setMessage(httpMessage)
- Set message response
- @param httpMessage string message
-
setAppendMessage(appendMsg, direction = 'list')
- set http status message by http status code
- @param appendMsg string message
-
setAppendMessageDir(direction)
- set http status message with direction by http status code
- @param direction string message
Example use
use App\Libraries\ApiResponse;
class BlogService {
/** function to get data blogs */
...
$results = Blog::all();
return ApiResponse::make(true, 'Data loaded', $results);
...
}