@@ -20,396 +20,396 @@ |
||
20 | 20 | |
21 | 21 | class LiveEngageLaravel |
22 | 22 | { |
23 | - private $account = false; |
|
24 | - private $results = []; |
|
25 | - private $skills = []; |
|
26 | - private $next = false; |
|
27 | - private $prev = false; |
|
28 | - private $start; |
|
29 | - private $end; |
|
30 | - private $config = 'services.liveperson.default'; |
|
31 | - private $version = '1.0'; |
|
32 | - private $history_limit = 50; |
|
33 | - private $history = false; |
|
34 | - private $context = 'interactionHistoryRecords'; |
|
35 | - private $interactive = true; |
|
36 | - private $ended = true; |
|
37 | - private $bearer = false; |
|
38 | - |
|
39 | - private $domain = false; |
|
40 | - |
|
41 | - private $retry_limit = 5; |
|
42 | - private $retry_counter = 0; |
|
43 | - |
|
44 | - public function __get($attribute) |
|
45 | - { |
|
46 | - return $this->$attribute; |
|
47 | - } |
|
48 | - |
|
49 | - public function __set($attribute, $value) |
|
50 | - { |
|
51 | - return $this->$attribute = $value; |
|
52 | - } |
|
53 | - |
|
54 | - public function __construct() |
|
55 | - { |
|
56 | - $this->account = config("{$this->config}.account"); |
|
57 | - //$this->domain = config("{$this->config}.domain"); |
|
58 | - $this->version = config("{$this->config}.version") ?: $this->version; |
|
59 | - } |
|
60 | - |
|
61 | - public function key($key = 'default') |
|
62 | - { |
|
63 | - $this->config = "services.liveperson.$key"; |
|
64 | - |
|
65 | - return $this; |
|
66 | - } |
|
23 | + private $account = false; |
|
24 | + private $results = []; |
|
25 | + private $skills = []; |
|
26 | + private $next = false; |
|
27 | + private $prev = false; |
|
28 | + private $start; |
|
29 | + private $end; |
|
30 | + private $config = 'services.liveperson.default'; |
|
31 | + private $version = '1.0'; |
|
32 | + private $history_limit = 50; |
|
33 | + private $history = false; |
|
34 | + private $context = 'interactionHistoryRecords'; |
|
35 | + private $interactive = true; |
|
36 | + private $ended = true; |
|
37 | + private $bearer = false; |
|
38 | + |
|
39 | + private $domain = false; |
|
40 | + |
|
41 | + private $retry_limit = 5; |
|
42 | + private $retry_counter = 0; |
|
43 | + |
|
44 | + public function __get($attribute) |
|
45 | + { |
|
46 | + return $this->$attribute; |
|
47 | + } |
|
48 | + |
|
49 | + public function __set($attribute, $value) |
|
50 | + { |
|
51 | + return $this->$attribute = $value; |
|
52 | + } |
|
53 | + |
|
54 | + public function __construct() |
|
55 | + { |
|
56 | + $this->account = config("{$this->config}.account"); |
|
57 | + //$this->domain = config("{$this->config}.domain"); |
|
58 | + $this->version = config("{$this->config}.version") ?: $this->version; |
|
59 | + } |
|
60 | + |
|
61 | + public function key($key = 'default') |
|
62 | + { |
|
63 | + $this->config = "services.liveperson.$key"; |
|
64 | + |
|
65 | + return $this; |
|
66 | + } |
|
67 | 67 | |
68 | - public function nonInteractive() |
|
69 | - { |
|
70 | - $this->interactive = false; |
|
71 | - return $this; |
|
72 | - } |
|
68 | + public function nonInteractive() |
|
69 | + { |
|
70 | + $this->interactive = false; |
|
71 | + return $this; |
|
72 | + } |
|
73 | 73 | |
74 | - public function active() |
|
75 | - { |
|
76 | - $this->ended = false; |
|
77 | - return $this; |
|
78 | - } |
|
79 | - |
|
80 | - public function limit($limit) |
|
81 | - { |
|
82 | - $this->history_limit = $limit; |
|
83 | - |
|
84 | - return $this; |
|
85 | - } |
|
86 | - |
|
87 | - public function skills($skills) |
|
88 | - { |
|
89 | - $this->skills = $skills; |
|
90 | - |
|
91 | - return $this; |
|
92 | - } |
|
93 | - |
|
94 | - public function retry($limit) |
|
95 | - { |
|
96 | - $this->retry_limit = $limit; |
|
97 | - |
|
98 | - return $this; |
|
99 | - } |
|
100 | - |
|
101 | - public function get() |
|
102 | - { |
|
103 | - return $this->results; |
|
104 | - } |
|
105 | - |
|
106 | - public function account($accountid) |
|
107 | - { |
|
108 | - $this->account = $accountid; |
|
109 | - |
|
110 | - return $this; |
|
111 | - } |
|
112 | - |
|
113 | - public function domain($service) |
|
114 | - { |
|
115 | - $response = $this->requestV1("https://api.liveperson.net/api/account/{$this->account}/service/{$service}/baseURI.json?version={$this->version}", 'GET'); |
|
116 | - if (is_a($response, 'Exception')) { |
|
117 | - throw new \Exception('Unable to get LivePerson account domain', 101); |
|
118 | - } else { |
|
119 | - $this->domain = $response->baseURI; |
|
120 | - |
|
121 | - return $this; |
|
122 | - } |
|
123 | - } |
|
124 | - |
|
125 | - public function visitor($visitorID, $sessionID, $setData = false) |
|
126 | - { |
|
127 | - $this->domain('smt'); |
|
128 | - |
|
129 | - if ($setData) { |
|
130 | - $url = "https://{$this->domain}/api/account/{$this->account}/monitoring/visitors/{$visitorID}/visits/current/events?v=1&sid={$sessionID}"; |
|
131 | - |
|
132 | - return $this->requestV1($url, 'POST', $setData); |
|
133 | - } else { |
|
134 | - $url = "https://{$this->domain}/api/account/{$this->account}/monitoring/visitors/{$visitorID}/visits/current/state?v=1&sid={$sessionID}"; |
|
135 | - |
|
136 | - return $this->requestV1($url, 'GET'); |
|
137 | - } |
|
138 | - } |
|
139 | - |
|
140 | - final public function retrieveHistory(Carbon $start, Carbon $end, $url = false) |
|
141 | - { |
|
142 | - $this->domain('engHistDomain'); |
|
143 | - |
|
144 | - $url = $url ?: "https://{$this->domain}/interaction_history/api/account/{$this->account}/interactions/search?limit={$this->history_limit}&offset=0"; |
|
145 | - |
|
146 | - $start_str = $start->toW3cString(); |
|
147 | - $end_str = $end->toW3cString(); |
|
148 | - |
|
149 | - $data = [ |
|
150 | - 'interactive' => $this->interactive, |
|
151 | - 'ended' => $this->ended, |
|
152 | - 'start' => [ |
|
153 | - 'from' => strtotime($start_str).'000', |
|
154 | - 'to' => strtotime($end_str).'000', |
|
155 | - ], |
|
156 | - ]; |
|
157 | - if (count($this->skills)) { |
|
158 | - $data['skillIds'] = $this->skills; |
|
159 | - } |
|
160 | - |
|
161 | - $data = new Payload($data); |
|
162 | - |
|
163 | - return $this->requestV1($url, 'POST', $data); |
|
164 | - } |
|
165 | - |
|
166 | - final public function retrieveMsgHistory(Carbon $start, Carbon $end, $url = false) |
|
167 | - { |
|
168 | - $this->domain('msgHist'); |
|
169 | - |
|
170 | - $url = $url ?: "https://{$this->domain}/messaging_history/api/account/{$this->account}/conversations/search?limit={$this->history_limit}&offset=0"; |
|
171 | - |
|
172 | - $start_str = $start->toW3cString(); |
|
173 | - $end_str = $end->toW3cString(); |
|
174 | - |
|
175 | - $data = [ |
|
176 | - 'interactive' => $this->interactive, |
|
177 | - 'ended' => $this->ended, |
|
178 | - 'start' => [ |
|
179 | - 'from' => strtotime($start_str).'000', |
|
180 | - 'to' => strtotime($end_str).'000', |
|
181 | - ], |
|
182 | - ]; |
|
183 | - if (count($this->skills)) { |
|
184 | - $data['skillIds'] = $this->skills; |
|
185 | - } |
|
186 | - |
|
187 | - $data = new Payload($data); |
|
188 | - |
|
189 | - return $this->requestV1($url, 'POST', $data); |
|
190 | - } |
|
74 | + public function active() |
|
75 | + { |
|
76 | + $this->ended = false; |
|
77 | + return $this; |
|
78 | + } |
|
79 | + |
|
80 | + public function limit($limit) |
|
81 | + { |
|
82 | + $this->history_limit = $limit; |
|
83 | + |
|
84 | + return $this; |
|
85 | + } |
|
86 | + |
|
87 | + public function skills($skills) |
|
88 | + { |
|
89 | + $this->skills = $skills; |
|
90 | + |
|
91 | + return $this; |
|
92 | + } |
|
93 | + |
|
94 | + public function retry($limit) |
|
95 | + { |
|
96 | + $this->retry_limit = $limit; |
|
97 | + |
|
98 | + return $this; |
|
99 | + } |
|
100 | + |
|
101 | + public function get() |
|
102 | + { |
|
103 | + return $this->results; |
|
104 | + } |
|
105 | + |
|
106 | + public function account($accountid) |
|
107 | + { |
|
108 | + $this->account = $accountid; |
|
109 | + |
|
110 | + return $this; |
|
111 | + } |
|
112 | + |
|
113 | + public function domain($service) |
|
114 | + { |
|
115 | + $response = $this->requestV1("https://api.liveperson.net/api/account/{$this->account}/service/{$service}/baseURI.json?version={$this->version}", 'GET'); |
|
116 | + if (is_a($response, 'Exception')) { |
|
117 | + throw new \Exception('Unable to get LivePerson account domain', 101); |
|
118 | + } else { |
|
119 | + $this->domain = $response->baseURI; |
|
120 | + |
|
121 | + return $this; |
|
122 | + } |
|
123 | + } |
|
124 | + |
|
125 | + public function visitor($visitorID, $sessionID, $setData = false) |
|
126 | + { |
|
127 | + $this->domain('smt'); |
|
128 | + |
|
129 | + if ($setData) { |
|
130 | + $url = "https://{$this->domain}/api/account/{$this->account}/monitoring/visitors/{$visitorID}/visits/current/events?v=1&sid={$sessionID}"; |
|
131 | + |
|
132 | + return $this->requestV1($url, 'POST', $setData); |
|
133 | + } else { |
|
134 | + $url = "https://{$this->domain}/api/account/{$this->account}/monitoring/visitors/{$visitorID}/visits/current/state?v=1&sid={$sessionID}"; |
|
135 | + |
|
136 | + return $this->requestV1($url, 'GET'); |
|
137 | + } |
|
138 | + } |
|
139 | + |
|
140 | + final public function retrieveHistory(Carbon $start, Carbon $end, $url = false) |
|
141 | + { |
|
142 | + $this->domain('engHistDomain'); |
|
143 | + |
|
144 | + $url = $url ?: "https://{$this->domain}/interaction_history/api/account/{$this->account}/interactions/search?limit={$this->history_limit}&offset=0"; |
|
145 | + |
|
146 | + $start_str = $start->toW3cString(); |
|
147 | + $end_str = $end->toW3cString(); |
|
148 | + |
|
149 | + $data = [ |
|
150 | + 'interactive' => $this->interactive, |
|
151 | + 'ended' => $this->ended, |
|
152 | + 'start' => [ |
|
153 | + 'from' => strtotime($start_str).'000', |
|
154 | + 'to' => strtotime($end_str).'000', |
|
155 | + ], |
|
156 | + ]; |
|
157 | + if (count($this->skills)) { |
|
158 | + $data['skillIds'] = $this->skills; |
|
159 | + } |
|
160 | + |
|
161 | + $data = new Payload($data); |
|
162 | + |
|
163 | + return $this->requestV1($url, 'POST', $data); |
|
164 | + } |
|
165 | + |
|
166 | + final public function retrieveMsgHistory(Carbon $start, Carbon $end, $url = false) |
|
167 | + { |
|
168 | + $this->domain('msgHist'); |
|
169 | + |
|
170 | + $url = $url ?: "https://{$this->domain}/messaging_history/api/account/{$this->account}/conversations/search?limit={$this->history_limit}&offset=0"; |
|
171 | + |
|
172 | + $start_str = $start->toW3cString(); |
|
173 | + $end_str = $end->toW3cString(); |
|
174 | + |
|
175 | + $data = [ |
|
176 | + 'interactive' => $this->interactive, |
|
177 | + 'ended' => $this->ended, |
|
178 | + 'start' => [ |
|
179 | + 'from' => strtotime($start_str).'000', |
|
180 | + 'to' => strtotime($end_str).'000', |
|
181 | + ], |
|
182 | + ]; |
|
183 | + if (count($this->skills)) { |
|
184 | + $data['skillIds'] = $this->skills; |
|
185 | + } |
|
186 | + |
|
187 | + $data = new Payload($data); |
|
188 | + |
|
189 | + return $this->requestV1($url, 'POST', $data); |
|
190 | + } |
|
191 | 191 | |
192 | - public function getAgentStatus(array $skills) |
|
193 | - { |
|
192 | + public function getAgentStatus(array $skills) |
|
193 | + { |
|
194 | 194 | |
195 | - $this->domain('msgHist'); |
|
195 | + $this->domain('msgHist'); |
|
196 | 196 | |
197 | - $url = "https://{$this->domain}/messaging_history/api/account/{$this->account}/agent-view/status"; |
|
197 | + $url = "https://{$this->domain}/messaging_history/api/account/{$this->account}/agent-view/status"; |
|
198 | 198 | |
199 | - $data['skillIds'] = $skills; |
|
199 | + $data['skillIds'] = $skills; |
|
200 | 200 | |
201 | - $response = $this->requestV1($url, 'POST', $data); |
|
202 | - $agents = []; |
|
201 | + $response = $this->requestV1($url, 'POST', $data); |
|
202 | + $agents = []; |
|
203 | 203 | |
204 | - foreach ($response->agentStatusRecords as $agent) { |
|
205 | - $agents[] = new Agent((array) $agent); |
|
206 | - } |
|
204 | + foreach ($response->agentStatusRecords as $agent) { |
|
205 | + $agents[] = new Agent((array) $agent); |
|
206 | + } |
|
207 | 207 | |
208 | - $collection = new Humans($agents); |
|
209 | - $collection->metaData = $response->_metadata; |
|
208 | + $collection = new Humans($agents); |
|
209 | + $collection->metaData = $response->_metadata; |
|
210 | 210 | |
211 | - return $collection; |
|
211 | + return $collection; |
|
212 | 212 | |
213 | - } |
|
213 | + } |
|
214 | 214 | |
215 | - public function messagingHistory(Carbon $start = null, Carbon $end = null) |
|
216 | - { |
|
217 | - $this->retry_counter = 0; |
|
215 | + public function messagingHistory(Carbon $start = null, Carbon $end = null) |
|
216 | + { |
|
217 | + $this->retry_counter = 0; |
|
218 | 218 | |
219 | - $start = $start ?: (new Carbon())->today(); |
|
220 | - $end = $end ?: (new Carbon())->today()->addHours(23)->addMinutes(59); |
|
219 | + $start = $start ?: (new Carbon())->today(); |
|
220 | + $end = $end ?: (new Carbon())->today()->addHours(23)->addMinutes(59); |
|
221 | 221 | |
222 | - $this->start = $start; |
|
223 | - $this->end = $end; |
|
222 | + $this->start = $start; |
|
223 | + $this->end = $end; |
|
224 | 224 | |
225 | 225 | if (is_object($results_object)) { |
226 | 226 | |
227 | - $results_object = $this->retrieveMsgHistory($start, $end); |
|
228 | - $results = $results_object->conversationHistoryRecords; |
|
229 | - if (property_exists($results_object->_metadata, 'next')) { |
|
230 | - $this->next = $results_object->_metadata->next->href; |
|
231 | - } |
|
232 | - if (property_exists($results_object->_metadata, 'prev')) { |
|
233 | - $this->prev = $results_object->_metadata->prev->href; |
|
234 | - } |
|
227 | + $results_object = $this->retrieveMsgHistory($start, $end); |
|
228 | + $results = $results_object->conversationHistoryRecords; |
|
229 | + if (property_exists($results_object->_metadata, 'next')) { |
|
230 | + $this->next = $results_object->_metadata->next->href; |
|
231 | + } |
|
232 | + if (property_exists($results_object->_metadata, 'prev')) { |
|
233 | + $this->prev = $results_object->_metadata->prev->href; |
|
234 | + } |
|
235 | 235 | |
236 | - $history = []; |
|
237 | - foreach ($results as $item) { |
|
238 | - if (property_exists($item, 'info')) { |
|
239 | - $item->info = new Info((array) $item->info); |
|
240 | - } |
|
236 | + $history = []; |
|
237 | + foreach ($results as $item) { |
|
238 | + if (property_exists($item, 'info')) { |
|
239 | + $item->info = new Info((array) $item->info); |
|
240 | + } |
|
241 | 241 | |
242 | - if (property_exists($item, 'visitorInfo')) { |
|
243 | - $item->visitorInfo = new Visitor((array) $item->visitorInfo); |
|
244 | - } |
|
242 | + if (property_exists($item, 'visitorInfo')) { |
|
243 | + $item->visitorInfo = new Visitor((array) $item->visitorInfo); |
|
244 | + } |
|
245 | 245 | |
246 | - if (property_exists($item, 'campaign')) { |
|
247 | - $item->campaign = new Campaign((array) $item->campaign); |
|
248 | - } |
|
246 | + if (property_exists($item, 'campaign')) { |
|
247 | + $item->campaign = new Campaign((array) $item->campaign); |
|
248 | + } |
|
249 | 249 | |
250 | - $history[] = new Conversation((array) $item); |
|
251 | - } |
|
250 | + $history[] = new Conversation((array) $item); |
|
251 | + } |
|
252 | 252 | |
253 | - $collection = new ConversationHistory($history, $this); |
|
254 | - $collection->metaData = $results_object->_metadata; |
|
253 | + $collection = new ConversationHistory($history, $this); |
|
254 | + $collection->metaData = $results_object->_metadata; |
|
255 | 255 | |
256 | - return $collection; |
|
256 | + return $collection; |
|
257 | 257 | |
258 | - } else { |
|
259 | - return false; |
|
260 | - } |
|
261 | - } |
|
258 | + } else { |
|
259 | + return false; |
|
260 | + } |
|
261 | + } |
|
262 | 262 | |
263 | - public function history(Carbon $start = null, Carbon $end = null) |
|
264 | - { |
|
265 | - $this->retry_counter = 0; |
|
263 | + public function history(Carbon $start = null, Carbon $end = null) |
|
264 | + { |
|
265 | + $this->retry_counter = 0; |
|
266 | 266 | |
267 | - $start = $start ?: (new Carbon())->today(); |
|
268 | - $end = $end ?: (new Carbon())->today()->addHours(23)->addMinutes(59); |
|
267 | + $start = $start ?: (new Carbon())->today(); |
|
268 | + $end = $end ?: (new Carbon())->today()->addHours(23)->addMinutes(59); |
|
269 | 269 | |
270 | - $this->start = $start; |
|
271 | - $this->end = $end; |
|
270 | + $this->start = $start; |
|
271 | + $this->end = $end; |
|
272 | 272 | |
273 | - $results_object = $this->retrieveHistory($start, $end); |
|
273 | + $results_object = $this->retrieveHistory($start, $end); |
|
274 | 274 | |
275 | - if (is_object($results_object)) { |
|
275 | + if (is_object($results_object)) { |
|
276 | 276 | |
277 | - $results = $results_object->interactionHistoryRecords; |
|
278 | - if (property_exists($results_object->_metadata, 'next')) { |
|
279 | - $this->next = $results_object->_metadata->next->href; |
|
280 | - } |
|
281 | - if (property_exists($results_object->_metadata, 'prev')) { |
|
282 | - $this->prev = $results_object->_metadata->prev->href; |
|
283 | - } |
|
277 | + $results = $results_object->interactionHistoryRecords; |
|
278 | + if (property_exists($results_object->_metadata, 'next')) { |
|
279 | + $this->next = $results_object->_metadata->next->href; |
|
280 | + } |
|
281 | + if (property_exists($results_object->_metadata, 'prev')) { |
|
282 | + $this->prev = $results_object->_metadata->prev->href; |
|
283 | + } |
|
284 | 284 | |
285 | - $history = []; |
|
286 | - foreach ($results as $item) { |
|
287 | - if (property_exists($item, 'info')) { |
|
288 | - $item->info = new Info((array) $item->info); |
|
289 | - } |
|
285 | + $history = []; |
|
286 | + foreach ($results as $item) { |
|
287 | + if (property_exists($item, 'info')) { |
|
288 | + $item->info = new Info((array) $item->info); |
|
289 | + } |
|
290 | 290 | |
291 | - if (property_exists($item, 'visitorInfo')) { |
|
292 | - $item->visitorInfo = new Visitor((array) $item->visitorInfo); |
|
293 | - } |
|
291 | + if (property_exists($item, 'visitorInfo')) { |
|
292 | + $item->visitorInfo = new Visitor((array) $item->visitorInfo); |
|
293 | + } |
|
294 | 294 | |
295 | - if (property_exists($item, 'campaign')) { |
|
296 | - $item->campaign = new Campaign((array) $item->campaign); |
|
297 | - } |
|
295 | + if (property_exists($item, 'campaign')) { |
|
296 | + $item->campaign = new Campaign((array) $item->campaign); |
|
297 | + } |
|
298 | 298 | |
299 | - $history[] = new Engagement((array) $item); |
|
300 | - } |
|
299 | + $history[] = new Engagement((array) $item); |
|
300 | + } |
|
301 | 301 | |
302 | - $collection = new EngagementHistory($history, $this); |
|
303 | - $collection->metaData = $results_object->_metadata; |
|
302 | + $collection = new EngagementHistory($history, $this); |
|
303 | + $collection->metaData = $results_object->_metadata; |
|
304 | 304 | |
305 | - return $collection; |
|
305 | + return $collection; |
|
306 | 306 | |
307 | - } else { |
|
308 | - return false; |
|
309 | - } |
|
310 | - } |
|
307 | + } else { |
|
308 | + return false; |
|
309 | + } |
|
310 | + } |
|
311 | 311 | |
312 | - public function login() |
|
313 | - { |
|
314 | - $this->domain('agentVep'); |
|
312 | + public function login() |
|
313 | + { |
|
314 | + $this->domain('agentVep'); |
|
315 | 315 | |
316 | - $consumer_key = config("{$this->config}.key"); |
|
317 | - $consumer_secret = config("{$this->config}.secret"); |
|
318 | - $token = config("{$this->config}.token"); |
|
319 | - $secret = config("{$this->config}.token_secret"); |
|
320 | - $username = config("{$this->config}.user_name"); |
|
316 | + $consumer_key = config("{$this->config}.key"); |
|
317 | + $consumer_secret = config("{$this->config}.secret"); |
|
318 | + $token = config("{$this->config}.token"); |
|
319 | + $secret = config("{$this->config}.token_secret"); |
|
320 | + $username = config("{$this->config}.user_name"); |
|
321 | 321 | |
322 | - $auth = [ |
|
323 | - 'username' => $username, |
|
324 | - 'appKey' => $consumer_key, |
|
325 | - 'secret' => $consumer_secret, |
|
326 | - 'accessToken' => $token, |
|
327 | - 'accessTokenSecret' => $secret, |
|
328 | - ]; |
|
322 | + $auth = [ |
|
323 | + 'username' => $username, |
|
324 | + 'appKey' => $consumer_key, |
|
325 | + 'secret' => $consumer_secret, |
|
326 | + 'accessToken' => $token, |
|
327 | + 'accessTokenSecret' => $secret, |
|
328 | + ]; |
|
329 | 329 | |
330 | - $url = "https://{$this->domain}/api/account/{$this->account}/login?v=1.3"; |
|
330 | + $url = "https://{$this->domain}/api/account/{$this->account}/login?v=1.3"; |
|
331 | 331 | |
332 | - $response = $this->requestV1($url, 'POST', $auth); |
|
332 | + $response = $this->requestV1($url, 'POST', $auth); |
|
333 | 333 | |
334 | - $this->bearer = $response->bearer; |
|
334 | + $this->bearer = $response->bearer; |
|
335 | 335 | |
336 | - return $this; |
|
337 | - } |
|
336 | + return $this; |
|
337 | + } |
|
338 | 338 | |
339 | - private function requestV2($url, $method, $payload = false) |
|
340 | - { |
|
341 | - if (!$this->bearer) $this->login(); |
|
339 | + private function requestV2($url, $method, $payload = false) |
|
340 | + { |
|
341 | + if (!$this->bearer) $this->login(); |
|
342 | 342 | |
343 | - $client = new Client(); |
|
344 | - $args = [ |
|
345 | - 'headers' => [ |
|
346 | - 'Authorization' => $this->bearer |
|
347 | - ] |
|
348 | - ]; |
|
343 | + $client = new Client(); |
|
344 | + $args = [ |
|
345 | + 'headers' => [ |
|
346 | + 'Authorization' => $this->bearer |
|
347 | + ] |
|
348 | + ]; |
|
349 | 349 | |
350 | - if ($payload !== false) { |
|
351 | - $args['body'] = json_encode($payload); |
|
352 | - } |
|
350 | + if ($payload !== false) { |
|
351 | + $args['body'] = json_encode($payload); |
|
352 | + } |
|
353 | 353 | |
354 | - try { |
|
355 | - $res = $client->request($method, $url, $args); |
|
356 | - } catch (\Exception $e) { |
|
357 | - throw $e; |
|
358 | - } |
|
354 | + try { |
|
355 | + $res = $client->request($method, $url, $args); |
|
356 | + } catch (\Exception $e) { |
|
357 | + throw $e; |
|
358 | + } |
|
359 | 359 | |
360 | - return json_decode($res->getBody()); |
|
361 | - } |
|
362 | - |
|
363 | - private function requestV1($url, $method, $payload = false) |
|
364 | - { |
|
365 | - $consumer_key = config("{$this->config}.key"); |
|
366 | - $consumer_secret = config("{$this->config}.secret"); |
|
367 | - $token = config("{$this->config}.token"); |
|
368 | - $secret = config("{$this->config}.token_secret"); |
|
369 | - |
|
370 | - $stack = HandlerStack::create(); |
|
371 | - $auth = new Oauth1([ |
|
372 | - 'consumer_key' => $consumer_key, |
|
373 | - 'consumer_secret' => $consumer_secret, |
|
374 | - 'token' => $token, |
|
375 | - 'token_secret' => $secret, |
|
376 | - 'signature_method'=> Oauth1::SIGNATURE_METHOD_HMAC, |
|
377 | - ]); |
|
378 | - $stack->push($auth); |
|
379 | - |
|
380 | - $client = new Client([ |
|
381 | - 'handler' => $stack, |
|
382 | - ]); |
|
383 | - |
|
384 | - $args = [ |
|
385 | - 'auth' => 'oauth', |
|
386 | - 'headers' => [ |
|
387 | - 'content-type' => 'application/json', |
|
388 | - ], |
|
389 | - ]; |
|
390 | - |
|
391 | - if ($payload !== false) { |
|
392 | - $args['body'] = json_encode($payload); |
|
393 | - } |
|
394 | - |
|
395 | - try { |
|
396 | - $res = $client->request($method, $url, $args); |
|
397 | - |
|
398 | - $response = json_decode($res->getBody()); |
|
399 | - } catch (\GuzzleHttp\Exception\ConnectException $connection) { |
|
400 | - return $connection; |
|
401 | - } catch (\GuzzleHttp\Exception\ClientException $clientException) { |
|
402 | - return $clientException; |
|
403 | - } catch (\Exception $e) { |
|
404 | - if ($this->retry_counter < $this->retry_limit || $this->retry_limit == -1) { |
|
405 | - usleep(1500); |
|
406 | - $this->retry_counter++; |
|
407 | - $response = $this->requestV1($url, $payload); |
|
408 | - } else { |
|
409 | - throw $e; //new LiveEngageException("Retry limit has been exceeded ($this->retry_limit)", 100); |
|
410 | - } |
|
411 | - } |
|
412 | - |
|
413 | - return $response; |
|
414 | - } |
|
360 | + return json_decode($res->getBody()); |
|
361 | + } |
|
362 | + |
|
363 | + private function requestV1($url, $method, $payload = false) |
|
364 | + { |
|
365 | + $consumer_key = config("{$this->config}.key"); |
|
366 | + $consumer_secret = config("{$this->config}.secret"); |
|
367 | + $token = config("{$this->config}.token"); |
|
368 | + $secret = config("{$this->config}.token_secret"); |
|
369 | + |
|
370 | + $stack = HandlerStack::create(); |
|
371 | + $auth = new Oauth1([ |
|
372 | + 'consumer_key' => $consumer_key, |
|
373 | + 'consumer_secret' => $consumer_secret, |
|
374 | + 'token' => $token, |
|
375 | + 'token_secret' => $secret, |
|
376 | + 'signature_method'=> Oauth1::SIGNATURE_METHOD_HMAC, |
|
377 | + ]); |
|
378 | + $stack->push($auth); |
|
379 | + |
|
380 | + $client = new Client([ |
|
381 | + 'handler' => $stack, |
|
382 | + ]); |
|
383 | + |
|
384 | + $args = [ |
|
385 | + 'auth' => 'oauth', |
|
386 | + 'headers' => [ |
|
387 | + 'content-type' => 'application/json', |
|
388 | + ], |
|
389 | + ]; |
|
390 | + |
|
391 | + if ($payload !== false) { |
|
392 | + $args['body'] = json_encode($payload); |
|
393 | + } |
|
394 | + |
|
395 | + try { |
|
396 | + $res = $client->request($method, $url, $args); |
|
397 | + |
|
398 | + $response = json_decode($res->getBody()); |
|
399 | + } catch (\GuzzleHttp\Exception\ConnectException $connection) { |
|
400 | + return $connection; |
|
401 | + } catch (\GuzzleHttp\Exception\ClientException $clientException) { |
|
402 | + return $clientException; |
|
403 | + } catch (\Exception $e) { |
|
404 | + if ($this->retry_counter < $this->retry_limit || $this->retry_limit == -1) { |
|
405 | + usleep(1500); |
|
406 | + $this->retry_counter++; |
|
407 | + $response = $this->requestV1($url, $payload); |
|
408 | + } else { |
|
409 | + throw $e; //new LiveEngageException("Retry limit has been exceeded ($this->retry_limit)", 100); |
|
410 | + } |
|
411 | + } |
|
412 | + |
|
413 | + return $response; |
|
414 | + } |
|
415 | 415 | } |
@@ -150,8 +150,8 @@ discard block |
||
150 | 150 | 'interactive' => $this->interactive, |
151 | 151 | 'ended' => $this->ended, |
152 | 152 | 'start' => [ |
153 | - 'from' => strtotime($start_str).'000', |
|
154 | - 'to' => strtotime($end_str).'000', |
|
153 | + 'from' => strtotime($start_str) . '000', |
|
154 | + 'to' => strtotime($end_str) . '000', |
|
155 | 155 | ], |
156 | 156 | ]; |
157 | 157 | if (count($this->skills)) { |
@@ -176,8 +176,8 @@ discard block |
||
176 | 176 | 'interactive' => $this->interactive, |
177 | 177 | 'ended' => $this->ended, |
178 | 178 | 'start' => [ |
179 | - 'from' => strtotime($start_str).'000', |
|
180 | - 'to' => strtotime($end_str).'000', |
|
179 | + 'from' => strtotime($start_str) . '000', |
|
180 | + 'to' => strtotime($end_str) . '000', |
|
181 | 181 | ], |
182 | 182 | ]; |
183 | 183 | if (count($this->skills)) { |
@@ -338,7 +338,9 @@ |
||
338 | 338 | |
339 | 339 | private function requestV2($url, $method, $payload = false) |
340 | 340 | { |
341 | - if (!$this->bearer) $this->login(); |
|
341 | + if (!$this->bearer) { |
|
342 | + $this->login(); |
|
343 | + } |
|
342 | 344 | |
343 | 345 | $client = new Client(); |
344 | 346 | $args = [ |
@@ -7,20 +7,20 @@ |
||
7 | 7 | |
8 | 8 | class Agent extends Model |
9 | 9 | { |
10 | - protected $guarded = []; |
|
10 | + protected $guarded = []; |
|
11 | 11 | |
12 | - public function getLastUpdatedTimeAttribute() |
|
13 | - { |
|
14 | - return new Carbon($this->attributes['lastUpdatedTime']); |
|
15 | - } |
|
12 | + public function getLastUpdatedTimeAttribute() |
|
13 | + { |
|
14 | + return new Carbon($this->attributes['lastUpdatedTime']); |
|
15 | + } |
|
16 | 16 | |
17 | - public function getCurrentStatusStartTimeAttribute() |
|
18 | - { |
|
19 | - return new Carbon($this->attributes['currentStatusStartTime']); |
|
20 | - } |
|
17 | + public function getCurrentStatusStartTimeAttribute() |
|
18 | + { |
|
19 | + return new Carbon($this->attributes['currentStatusStartTime']); |
|
20 | + } |
|
21 | 21 | |
22 | - public function getCurrentStatusReasonStartTimeAttribute() |
|
23 | - { |
|
24 | - return new Carbon($this->attributes['currentStatusReasonStartTime']); |
|
25 | - } |
|
22 | + public function getCurrentStatusReasonStartTimeAttribute() |
|
23 | + { |
|
24 | + return new Carbon($this->attributes['currentStatusReasonStartTime']); |
|
25 | + } |
|
26 | 26 | } |
27 | 27 | \ No newline at end of file |
@@ -6,5 +6,5 @@ |
||
6 | 6 | |
7 | 7 | class Visitor extends Model |
8 | 8 | { |
9 | - protected $guarded = []; |
|
9 | + protected $guarded = []; |
|
10 | 10 | } |
11 | 11 | \ No newline at end of file |
@@ -11,103 +11,103 @@ |
||
11 | 11 | |
12 | 12 | class EngagementHistory extends Collection |
13 | 13 | { |
14 | - private $instance; |
|
14 | + private $instance; |
|
15 | 15 | |
16 | - public function __construct(array $models = [], LiveEngageLaravel $instance = null) |
|
17 | - { |
|
18 | - $this->instance = $instance; |
|
16 | + public function __construct(array $models = [], LiveEngageLaravel $instance = null) |
|
17 | + { |
|
18 | + $this->instance = $instance; |
|
19 | 19 | |
20 | - parent::__construct($models); |
|
21 | - } |
|
20 | + parent::__construct($models); |
|
21 | + } |
|
22 | 22 | |
23 | - public function find($engagementID) |
|
24 | - { |
|
25 | - $result = $this->filter(function ($value, $key) use ($engagementID) { |
|
26 | - return $value->info->sessionId == $engagementID; |
|
27 | - }); |
|
23 | + public function find($engagementID) |
|
24 | + { |
|
25 | + $result = $this->filter(function ($value, $key) use ($engagementID) { |
|
26 | + return $value->info->sessionId == $engagementID; |
|
27 | + }); |
|
28 | 28 | |
29 | - return $result->first(); |
|
30 | - } |
|
29 | + return $result->first(); |
|
30 | + } |
|
31 | 31 | |
32 | - public function next() |
|
33 | - { |
|
34 | - if (! $this->instance) { |
|
35 | - return false; |
|
36 | - } |
|
32 | + public function next() |
|
33 | + { |
|
34 | + if (! $this->instance) { |
|
35 | + return false; |
|
36 | + } |
|
37 | 37 | |
38 | - $instance = $this->instance; |
|
38 | + $instance = $this->instance; |
|
39 | 39 | |
40 | - $next = $instance->retrieveHistory($instance->start, $instance->end, $instance->next); |
|
41 | - if (property_exists($next->_metadata, 'next')) { |
|
42 | - $instance->next = $next->_metadata->next->href; |
|
40 | + $next = $instance->retrieveHistory($instance->start, $instance->end, $instance->next); |
|
41 | + if (property_exists($next->_metadata, 'next')) { |
|
42 | + $instance->next = $next->_metadata->next->href; |
|
43 | 43 | |
44 | - $history = []; |
|
45 | - foreach ($next->interactionHistoryRecords as $item) { |
|
44 | + $history = []; |
|
45 | + foreach ($next->interactionHistoryRecords as $item) { |
|
46 | 46 | |
47 | - if (property_exists($item, 'info')) { |
|
48 | - $item->info = new Info((array) $item->info); |
|
49 | - } |
|
47 | + if (property_exists($item, 'info')) { |
|
48 | + $item->info = new Info((array) $item->info); |
|
49 | + } |
|
50 | 50 | |
51 | - if (property_exists($item, 'visitorInfo')) { |
|
52 | - $item->visitorInfo = new Visitor((array) $item->visitorInfo); |
|
53 | - } |
|
51 | + if (property_exists($item, 'visitorInfo')) { |
|
52 | + $item->visitorInfo = new Visitor((array) $item->visitorInfo); |
|
53 | + } |
|
54 | 54 | |
55 | - if (property_exists($item, 'campaign')) { |
|
56 | - $item->campaign = new Campaign((array) $item->campaign); |
|
57 | - } |
|
55 | + if (property_exists($item, 'campaign')) { |
|
56 | + $item->campaign = new Campaign((array) $item->campaign); |
|
57 | + } |
|
58 | 58 | |
59 | - $history[] = new Engagement((array) $item); |
|
60 | - } |
|
59 | + $history[] = new Engagement((array) $item); |
|
60 | + } |
|
61 | 61 | |
62 | - return $this->merge(new EngagementHistory($history)); |
|
63 | - } else { |
|
64 | - return false; |
|
65 | - } |
|
66 | - } |
|
62 | + return $this->merge(new EngagementHistory($history)); |
|
63 | + } else { |
|
64 | + return false; |
|
65 | + } |
|
66 | + } |
|
67 | 67 | |
68 | - public function prev() |
|
69 | - { |
|
70 | - if (! $this->instance) { |
|
71 | - return false; |
|
72 | - } |
|
68 | + public function prev() |
|
69 | + { |
|
70 | + if (! $this->instance) { |
|
71 | + return false; |
|
72 | + } |
|
73 | 73 | |
74 | - $instance = $this->instance; |
|
74 | + $instance = $this->instance; |
|
75 | 75 | |
76 | - $prev = $instance->retrieveHistory($instance->start, $instance->end, $instance->prev); |
|
77 | - if (property_exists($prev->_metadata, 'prev')) { |
|
78 | - $instance->prev = $prev->_metadata->prev->href; |
|
76 | + $prev = $instance->retrieveHistory($instance->start, $instance->end, $instance->prev); |
|
77 | + if (property_exists($prev->_metadata, 'prev')) { |
|
78 | + $instance->prev = $prev->_metadata->prev->href; |
|
79 | 79 | |
80 | - $history = []; |
|
81 | - foreach ($next->interactionHistoryRecords as $item) { |
|
80 | + $history = []; |
|
81 | + foreach ($next->interactionHistoryRecords as $item) { |
|
82 | 82 | |
83 | - if (property_exists($item, 'info')) { |
|
84 | - $item->info = new Info((array) $item->info); |
|
85 | - } |
|
83 | + if (property_exists($item, 'info')) { |
|
84 | + $item->info = new Info((array) $item->info); |
|
85 | + } |
|
86 | 86 | |
87 | - if (property_exists($item, 'visitorInfo')) { |
|
88 | - $item->visitorInfo = new Visitor((array) $item->visitorInfo); |
|
89 | - } |
|
87 | + if (property_exists($item, 'visitorInfo')) { |
|
88 | + $item->visitorInfo = new Visitor((array) $item->visitorInfo); |
|
89 | + } |
|
90 | 90 | |
91 | - if (property_exists($item, 'campaign')) { |
|
92 | - $item->campaign = new Campaign((array) $item->campaign); |
|
93 | - } |
|
91 | + if (property_exists($item, 'campaign')) { |
|
92 | + $item->campaign = new Campaign((array) $item->campaign); |
|
93 | + } |
|
94 | 94 | |
95 | - $history[] = new Engagement((array) $item); |
|
96 | - } |
|
95 | + $history[] = new Engagement((array) $item); |
|
96 | + } |
|
97 | 97 | |
98 | - return $this->merge(new self($history)); |
|
99 | - } else { |
|
100 | - return false; |
|
101 | - } |
|
102 | - } |
|
98 | + return $this->merge(new self($history)); |
|
99 | + } else { |
|
100 | + return false; |
|
101 | + } |
|
102 | + } |
|
103 | 103 | |
104 | - public function getMetaDataAttribute() |
|
105 | - { |
|
106 | - return $this->attributes['_metaData']; |
|
107 | - } |
|
104 | + public function getMetaDataAttribute() |
|
105 | + { |
|
106 | + return $this->attributes['_metaData']; |
|
107 | + } |
|
108 | 108 | |
109 | - public function setMetaDataAttribute($value) |
|
110 | - { |
|
111 | - $this->attributes['_metaData'] = $value; |
|
112 | - } |
|
109 | + public function setMetaDataAttribute($value) |
|
110 | + { |
|
111 | + $this->attributes['_metaData'] = $value; |
|
112 | + } |
|
113 | 113 | } |
@@ -8,21 +8,21 @@ |
||
8 | 8 | class Humans extends Collection |
9 | 9 | { |
10 | 10 | public function getMetaDataAttribute() |
11 | - { |
|
12 | - return $this->attributes['_metaData']; |
|
13 | - } |
|
11 | + { |
|
12 | + return $this->attributes['_metaData']; |
|
13 | + } |
|
14 | 14 | |
15 | - public function setMetaDataAttribute($value) |
|
16 | - { |
|
17 | - $this->attributes['_metaData'] = $value; |
|
18 | - } |
|
15 | + public function setMetaDataAttribute($value) |
|
16 | + { |
|
17 | + $this->attributes['_metaData'] = $value; |
|
18 | + } |
|
19 | 19 | |
20 | - public function state($state = 'ONLINE') |
|
21 | - { |
|
22 | - $result = $this->filter(function ($value, $key) use ($state) { |
|
23 | - return strtolower($value->currentStatus) == strtolower($state); |
|
24 | - }); |
|
20 | + public function state($state = 'ONLINE') |
|
21 | + { |
|
22 | + $result = $this->filter(function ($value, $key) use ($state) { |
|
23 | + return strtolower($value->currentStatus) == strtolower($state); |
|
24 | + }); |
|
25 | 25 | |
26 | - return $result; |
|
27 | - } |
|
26 | + return $result; |
|
27 | + } |
|
28 | 28 | } |
29 | 29 | \ No newline at end of file |
@@ -19,7 +19,7 @@ |
||
19 | 19 | |
20 | 20 | public function state($state = 'ONLINE') |
21 | 21 | { |
22 | - $result = $this->filter(function ($value, $key) use ($state) { |
|
22 | + $result = $this->filter(function($value, $key) use ($state) { |
|
23 | 23 | return strtolower($value->currentStatus) == strtolower($state); |
24 | 24 | }); |
25 | 25 |
@@ -11,99 +11,99 @@ |
||
11 | 11 | |
12 | 12 | class ConversationHistory extends Collection |
13 | 13 | { |
14 | - private $instance; |
|
14 | + private $instance; |
|
15 | 15 | |
16 | - public function __construct(array $models = [], LiveEngageLaravel $instance = null) |
|
17 | - { |
|
18 | - $this->instance = $instance; |
|
16 | + public function __construct(array $models = [], LiveEngageLaravel $instance = null) |
|
17 | + { |
|
18 | + $this->instance = $instance; |
|
19 | 19 | |
20 | - parent::__construct($models); |
|
21 | - } |
|
20 | + parent::__construct($models); |
|
21 | + } |
|
22 | 22 | |
23 | - public function find($engagementID) |
|
24 | - { |
|
25 | - $result = $this->filter(function ($value, $key) use ($engagementID) { |
|
26 | - return $value->info->conversationId == $engagementID; |
|
27 | - }); |
|
23 | + public function find($engagementID) |
|
24 | + { |
|
25 | + $result = $this->filter(function ($value, $key) use ($engagementID) { |
|
26 | + return $value->info->conversationId == $engagementID; |
|
27 | + }); |
|
28 | 28 | |
29 | - return $result->first(); |
|
30 | - } |
|
29 | + return $result->first(); |
|
30 | + } |
|
31 | 31 | |
32 | - public function next() |
|
33 | - { |
|
34 | - if (! $this->instance) { |
|
35 | - return false; |
|
36 | - } |
|
32 | + public function next() |
|
33 | + { |
|
34 | + if (! $this->instance) { |
|
35 | + return false; |
|
36 | + } |
|
37 | 37 | |
38 | - $instance = $this->instance; |
|
38 | + $instance = $this->instance; |
|
39 | 39 | |
40 | - $next = $instance->retrieveMsgHistory($instance->start, $instance->end, $instance->next); |
|
41 | - if (property_exists($next->_metadata, 'next')) { |
|
42 | - $instance->next = $next->_metadata->next->href; |
|
40 | + $next = $instance->retrieveMsgHistory($instance->start, $instance->end, $instance->next); |
|
41 | + if (property_exists($next->_metadata, 'next')) { |
|
42 | + $instance->next = $next->_metadata->next->href; |
|
43 | 43 | |
44 | - $history = []; |
|
45 | - foreach ($next->conversationHistoryRecords as $item) { |
|
46 | - if (property_exists($item, 'info')) { |
|
47 | - $item->info = new Info((array) $item->info); |
|
48 | - } |
|
44 | + $history = []; |
|
45 | + foreach ($next->conversationHistoryRecords as $item) { |
|
46 | + if (property_exists($item, 'info')) { |
|
47 | + $item->info = new Info((array) $item->info); |
|
48 | + } |
|
49 | 49 | |
50 | - if (property_exists($item, 'visitorInfo')) { |
|
51 | - $item->visitorInfo = new Visitor((array) $item->visitorInfo); |
|
52 | - } |
|
50 | + if (property_exists($item, 'visitorInfo')) { |
|
51 | + $item->visitorInfo = new Visitor((array) $item->visitorInfo); |
|
52 | + } |
|
53 | 53 | |
54 | - if (property_exists($item, 'campaign')) { |
|
55 | - $item->campaign = new Campaign((array) $item->campaign); |
|
56 | - } |
|
57 | - $history[] = new Conversation((array) $item); |
|
58 | - } |
|
54 | + if (property_exists($item, 'campaign')) { |
|
55 | + $item->campaign = new Campaign((array) $item->campaign); |
|
56 | + } |
|
57 | + $history[] = new Conversation((array) $item); |
|
58 | + } |
|
59 | 59 | |
60 | - return $this->merge(new self($history)); |
|
61 | - } else { |
|
62 | - return false; |
|
63 | - } |
|
64 | - } |
|
60 | + return $this->merge(new self($history)); |
|
61 | + } else { |
|
62 | + return false; |
|
63 | + } |
|
64 | + } |
|
65 | 65 | |
66 | - public function prev() |
|
67 | - { |
|
68 | - if (! $this->instance) { |
|
69 | - return false; |
|
70 | - } |
|
66 | + public function prev() |
|
67 | + { |
|
68 | + if (! $this->instance) { |
|
69 | + return false; |
|
70 | + } |
|
71 | 71 | |
72 | - $instance = $this->instance; |
|
72 | + $instance = $this->instance; |
|
73 | 73 | |
74 | - $prev = $instance->retrieveMsgHistory($instance->start, $instance->end, $instance->prev); |
|
75 | - if (property_exists($prev->_metadata, 'prev')) { |
|
76 | - $instance->prev = $prev->_metadata->prev->href; |
|
74 | + $prev = $instance->retrieveMsgHistory($instance->start, $instance->end, $instance->prev); |
|
75 | + if (property_exists($prev->_metadata, 'prev')) { |
|
76 | + $instance->prev = $prev->_metadata->prev->href; |
|
77 | 77 | |
78 | - $history = []; |
|
79 | - foreach ($next->conversationHistoryRecords as $item) { |
|
80 | - if (property_exists($item, 'info')) { |
|
81 | - $item->info = new Info((array) $item->info); |
|
82 | - } |
|
78 | + $history = []; |
|
79 | + foreach ($next->conversationHistoryRecords as $item) { |
|
80 | + if (property_exists($item, 'info')) { |
|
81 | + $item->info = new Info((array) $item->info); |
|
82 | + } |
|
83 | 83 | |
84 | - if (property_exists($item, 'visitorInfo')) { |
|
85 | - $item->visitorInfo = new Visitor((array) $item->visitorInfo); |
|
86 | - } |
|
84 | + if (property_exists($item, 'visitorInfo')) { |
|
85 | + $item->visitorInfo = new Visitor((array) $item->visitorInfo); |
|
86 | + } |
|
87 | 87 | |
88 | - if (property_exists($item, 'campaign')) { |
|
89 | - $item->campaign = new Campaign((array) $item->campaign); |
|
90 | - } |
|
91 | - $history[] = new Conversation((array) $item); |
|
92 | - } |
|
88 | + if (property_exists($item, 'campaign')) { |
|
89 | + $item->campaign = new Campaign((array) $item->campaign); |
|
90 | + } |
|
91 | + $history[] = new Conversation((array) $item); |
|
92 | + } |
|
93 | 93 | |
94 | - return $this->merge(new self($history)); |
|
95 | - } else { |
|
96 | - return false; |
|
97 | - } |
|
98 | - } |
|
94 | + return $this->merge(new self($history)); |
|
95 | + } else { |
|
96 | + return false; |
|
97 | + } |
|
98 | + } |
|
99 | 99 | |
100 | - public function getMetaDataAttribute() |
|
101 | - { |
|
102 | - return $this->attributes['_metaData']; |
|
103 | - } |
|
100 | + public function getMetaDataAttribute() |
|
101 | + { |
|
102 | + return $this->attributes['_metaData']; |
|
103 | + } |
|
104 | 104 | |
105 | - public function setMetaDataAttribute($value) |
|
106 | - { |
|
107 | - $this->attributes['_metaData'] = $value; |
|
108 | - } |
|
105 | + public function setMetaDataAttribute($value) |
|
106 | + { |
|
107 | + $this->attributes['_metaData'] = $value; |
|
108 | + } |
|
109 | 109 | } |