PluginProbe
Fluent Support – Helpdesk & Customer Support Ticket System / 1.10.1
Fluent Support – Helpdesk & Customer Support Ticket System v1.10.1
2.4.0 2.3.2 2.3.1 2.3.0 2.2.1 2.2.0 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.4.0 1.4.1 1.4.2 1.4.5 1.4.6 1.4.7 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 All 68 releases
fluent-support / app / Http / Controllers / ActivityLoggerController.php

ActivityLoggerController.php in Fluent Support – Helpdesk & Customer Support Ticket System 1.10.1, at app/Http/Controllers/ActivityLoggerController.php

69 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentSupport\App\Http\Controllers;
4
5 use FluentSupport\App\Models\Activity;
6 use FluentSupport\Framework\Request\Request;
7
8 /**
9 * ActivityLoggerController class for REST API
10 * This class is responsible for getting data for all request related to activity and activity settings
11 * @package FluentSupport\App\Http\Controllers
12 *
13 * @version 1.0.0
14 */
15 class ActivityLoggerController extends Controller
16 {
17 /**
18 * getActivities method will get information regarding all activity with users(agent/customer) and activity settings
19 * @return \WP_REST_Response | array
20 */
21
22 public function getActivities (Request $request, Activity $activity)
23 {
24 try {
25 return $activity->getActivities( [
26 'page' => $request->getSafe('page', 'intval', 1),
27 'per_page' => $request->getSafe('per_page', 'intval', 10),
28 'from' => $request->getSafe('from', 'sanitize_text_field', ''),
29 'to' => $request->getSafe('to', 'sanitize_text_field', ''),
30 'filters' => $request->getSafe('filters', null, []),
31 ] );
32 } catch (\Exception $e) {
33 return $this->sendError([
34 'message' => $e->getMessage()
35 ]);
36 }
37 }
38
39 /**
40 * updateSettings method will update existing activity settings
41 * @return \WP_REST_Response | array
42 */
43 public function updateSettings (Request $request, Activity $activity)
44 {
45 try {
46 return $activity->updateSettings($request->getSafe('activity_settings', 'sanitize_text_field', []));
47 } catch (\Exception $e) {
48 return $this->sendError([
49 'message' => $e->getMessage()
50 ]);
51 }
52 }
53
54 /**
55 * getSettings method will get the list of activity settings and return
56 * @return \WP_REST_Response | array
57 */
58 public function getSettings(Activity $activity)
59 {
60 try {
61 return $activity->getSettings();
62 } catch (\Exception $e) {
63 return $this->sendError([
64 'message' => $e->getMessage()
65 ]);
66 }
67 }
68 }
69