1 | <?php |
||
7 | abstract class BaseChannel implements Contract |
||
8 | { |
||
9 | private function getActionMessage() |
||
10 | { |
||
11 | return config('firewall.notifications.message.message'); |
||
12 | } |
||
13 | |||
14 | /** |
||
15 | * @param $item |
||
16 | * |
||
17 | * @return string |
||
18 | */ |
||
19 | protected function getMessage($item) |
||
20 | { |
||
21 | $domain = Request::server('SERVER_NAME'); |
||
22 | |||
23 | return sprintf($this->getActionMessage(), $domain, $this->makeMessage($item)); |
||
24 | } |
||
25 | |||
26 | /** |
||
27 | * @param $item |
||
28 | * |
||
29 | * @return mixed |
||
30 | */ |
||
31 | protected function makeMessage($item) |
||
32 | { |
||
33 | $ip = "{$item['ipAddress']} - {$item['host']}"; |
||
34 | |||
35 | if ($item['type'] == 'ip') { |
||
36 | return "$ip"; |
||
37 | } |
||
38 | |||
39 | return "{$item['country_code']}-{$item['country_name']} ({$ip})"; |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * Make a geolocation model for the item. |
||
44 | * |
||
45 | * @param $item |
||
46 | * |
||
47 | * @return array |
||
48 | */ |
||
49 | 5 | public function makeGeolocation($item) |
|
59 | } |
||
60 |