1$option = $_GET['option'];
2
3if ( $option == 1 ) {
4 $data = [ 'a', 'b', 'c' ];
5 // will encode to JSON array: ["a","b","c"]
6 // accessed as example in JavaScript like: result[1] (returns "b")
7} else {
8 $data = [ 'name' => 'God', 'age' => -1 ];
9 // will encode to JSON object: {"name":"God","age":-1}
10 // accessed as example in JavaScript like: result.name or result['name'] (returns "God")
11}
12
13header('Content-type: application/json');
14echo json_encode( $data );
15
1 $upgradeFlutterButton = new FlutterButton("UPGRADE", "2", "com.COMPANY.APP_NAME");
2
3 $postData = array(
4 'app_id' => 1,
5 'actions' => [
6 $upgradeFlutterButton
7 ],
8 'user_id' => 2,
9 );
10
11 $objectRequest = new \Illuminate\Http\Request();
12 $objectRequest->setMethod('POST');
13 $objectRequest->request->add($postData);
14
15 return $objectRequest;