Skip to main content

Helper References

Javascript#

formatDate#

Badaso provides a helper utility to change the date according to the specified format. The date format configuration can be changed in the file .env.

$helper.formatDate(date)

isObjectEmpty#

The following helper is used to check whether an object value is empty or not.

$helper.isObjectEmpty

PHP#

CaseConvert#

Badaso provides a helper for converting the case keys of an array and the properties of an object to specified cases.

CaseConvert::camel($object)
CaseConvert::snake($object)
CaseConvert::pascal($object)

The following is an example of the output of the helper.

input: {    "product_id": 1}
output: {    "productId": 1}

AuthenticatedUser#

The following helper is a helper to get information related to an incoming user or API caller using the JWT token. The information that available is user information, role and permissions.

AuthenticatedUser::getUser()
AuthenticatedUser::getRoles($user_id)
AuthenticatedUser::getPermissions($user_id)
AuthenticatedUser::isAllowedTo($permissions_string)

ApiResponse#

Helper ApiResponse is a helper for generating API output from the controller according to Badaso standards.

ApiResponse::success($reponse_data)
ApiResponse::failed($reponse_data)