This is the bread and butter ofmeaning that all responses are generated from this functionThis will return the following JSONIf we want to return a successful response, we would set thetoThis wil return the following JSON

Citrus::combine()

This is the secondary function of Citrus This function takes the data you have - whether it be array or object - and converts it into an array with a custom index. Great thing about this function: It's completely scalable. You can convert all of your data into one multidimensional array, with certain objects stored at custom indexes.

Param Required Type Default Description index true string N/A Defines the index at which your array will be created and stored array true array N/A The array you want stored

combine()

index

array

Example

Citrus::combine('user', $user);

user

$user

{ "success": 1, "error": null, "data": { "user": $user } }

Citrus::combine($index, $foo, $index2, $foo2 ....);

Citrus::combine('user', $user, 'message', $foo);

{ "success": 1, "error": null, "data": { "user": $user, "message": $foo } }

As mentioned before, thefunction is scalable. However, for it to work properly, it isthat you think of theand theas a pair. This function can accept an odd number of arguments, but it will ignore a trailing argument without its pair.This will build an array with an indexwhere the datawill be stored. After building the array, the function will then return the following JSON.We can also specify multiple arrays and indexes to be built. Each array and index pair must come in twos, so that if you want to define multiple indexes and data to be stored at index, it should look like this.An example of this is as follows.The responding JSON will look like this