Created
July 6, 2019 18:39
-
-
Save nutch31/0fcc7983d5244c764d95375dc9a3cd15 to your computer and use it in GitHub Desktop.
controller.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$query = Lead::whereIn('channel_id', $array_channel); | |
if(!empty($request->get('startDateTime')) && !empty($request->get('endDateTime'))) | |
{ | |
$startDateTime = Carbon::parse($request->get('startDateTime')); | |
$endDateTime = Carbon::parse($request->get('endDateTime')); | |
$query->whereBetween('submitted_date_time', [$startDateTime, $endDateTime]); | |
} | |
$query->orderBy('submitted_date_time', 'Asc'); | |
$response = $query->get(); | |
return response()->json([ | |
'response' => 'success', | |
'message' => 'Get lead success', | |
'data' => $response, | |
], 200); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"response": "success", | |
"message": "Get lead success", | |
"data": [ | |
{ | |
"id": 1, | |
"channel_id": 1, | |
"type": "submitted", | |
"submitted_date_time": "2019-07-07 00:20:23", | |
"form_name": "ณัฐ จันทาทับ", | |
"form_email": "[email protected]", | |
"form_phone": "0891233120", | |
"form_content": "{\"budget\":[\"2 \\u0e25\\u0e49\\u0e32\\u0e19\"],\"model\":[\"Mazda 2\"]}", | |
"form_ip_address": "127.0.0.1", | |
"form_page_url": "http://abc.com", | |
"call_phone": null, | |
"call_status": null, | |
"call_recording_url": null, | |
"call_forward_phone": null, | |
"is_duplicated": 0, | |
"parent_id": null, | |
"created_at": "2019-07-07 00:20:23", | |
"updated_at": "2019-07-07 00:20:23" | |
}, | |
{ | |
"id": 3, | |
"channel_id": 1, | |
"type": "submitted", | |
"submitted_date_time": "2019-07-07 00:31:08", | |
"form_name": "ณัฐ จันทาทับ", | |
"form_email": "[email protected]", | |
"form_phone": "0891233120", | |
"form_content": "{\"budget\":[\"2 \\u0e25\\u0e49\\u0e32\\u0e19\"],\"model\":[\"Mazda 2\"]}", | |
"form_ip_address": "127.0.0.1", | |
"form_page_url": "http://abc.com", | |
"call_phone": null, | |
"call_status": null, | |
"call_recording_url": null, | |
"call_forward_phone": null, | |
"is_duplicated": 1, | |
"parent_id": 1, | |
"created_at": "2019-07-07 00:31:08", | |
"updated_at": "2019-07-07 00:31:08" | |
}, | |
{ | |
"id": 5, | |
"channel_id": 1, | |
"type": "submitted", | |
"submitted_date_time": "2019-07-07 01:03:10", | |
"form_name": "ณัฐ จันทาทับ", | |
"form_email": "[email protected]", | |
"form_phone": "0891233120", | |
"form_content": "{\"budget\":[\"2 \\u0e25\\u0e49\\u0e32\\u0e19\"],\"model\":[\"Mazda 2\"]}", | |
"form_ip_address": "127.0.0.1", | |
"form_page_url": "http://abc.com", | |
"call_phone": null, | |
"call_status": null, | |
"call_recording_url": null, | |
"call_forward_phone": null, | |
"is_duplicated": 1, | |
"parent_id": 1, | |
"created_at": "2019-07-07 01:03:10", | |
"updated_at": "2019-07-07 01:03:10" | |
}, | |
{ | |
"id": 6, | |
"channel_id": 1, | |
"type": "submitted", | |
"submitted_date_time": "2019-07-07 01:10:34", | |
"form_name": "ณัฐ จันทาทับ", | |
"form_email": "[email protected]", | |
"form_phone": "0891233120", | |
"form_content": "{\"budget\":[\"2 \\u0e25\\u0e49\\u0e32\\u0e19\"],\"model\":[\"Mazda 2\"]}", | |
"form_ip_address": "127.0.0.1", | |
"form_page_url": "http://abc.com", | |
"call_phone": null, | |
"call_status": null, | |
"call_recording_url": null, | |
"call_forward_phone": null, | |
"is_duplicated": 1, | |
"parent_id": 1, | |
"created_at": "2019-07-07 01:10:34", | |
"updated_at": "2019-07-07 01:10:34" | |
}, | |
{ | |
"id": 7, | |
"channel_id": 1, | |
"type": "submitted", | |
"submitted_date_time": "2019-07-07 01:18:00", | |
"form_name": "ณัฐ จันทาทับ", | |
"form_email": "[email protected]", | |
"form_phone": "0891233120", | |
"form_content": "{\"budget\":[\"2 \\u0e25\\u0e49\\u0e32\\u0e19\"],\"model\":[\"Mazda 2\"]}", | |
"form_ip_address": "127.0.0.1", | |
"form_page_url": "http://abc.com", | |
"call_phone": null, | |
"call_status": null, | |
"call_recording_url": null, | |
"call_forward_phone": null, | |
"is_duplicated": 1, | |
"parent_id": 1, | |
"created_at": "2019-07-07 01:18:00", | |
"updated_at": "2019-07-07 01:18:00" | |
}, | |
{ | |
"id": 8, | |
"channel_id": 1, | |
"type": "submitted", | |
"submitted_date_time": "2019-07-07 01:19:51", | |
"form_name": "ณัฐ จันทาทับ", | |
"form_email": "[email protected]", | |
"form_phone": "0891233120", | |
"form_content": "{\"budget\":[\"2 \\u0e25\\u0e49\\u0e32\\u0e19\"],\"model\":[\"Mazda 2\"]}", | |
"form_ip_address": "127.0.0.1", | |
"form_page_url": "http://abc.com", | |
"call_phone": null, | |
"call_status": null, | |
"call_recording_url": null, | |
"call_forward_phone": null, | |
"is_duplicated": 1, | |
"parent_id": 1, | |
"created_at": "2019-07-07 01:19:51", | |
"updated_at": "2019-07-07 01:19:51" | |
}, | |
{ | |
"id": 9, | |
"channel_id": 1, | |
"type": "submitted", | |
"submitted_date_time": "2019-07-07 01:20:06", | |
"form_name": "ณัฐ จันทาทับ", | |
"form_email": "[email protected]", | |
"form_phone": "0891233120", | |
"form_content": "{\"budget\":[\"2 \\u0e25\\u0e49\\u0e32\\u0e19\"],\"model\":[\"Mazda 2\"]}", | |
"form_ip_address": "127.0.0.1", | |
"form_page_url": "http://abc.com", | |
"call_phone": null, | |
"call_status": null, | |
"call_recording_url": null, | |
"call_forward_phone": null, | |
"is_duplicated": 1, | |
"parent_id": 1, | |
"created_at": "2019-07-07 01:20:06", | |
"updated_at": "2019-07-07 01:20:06" | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment