Conditions | 1 |
Paths | 1 |
Total Lines | 18 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
21 | public function handle(ServerWasPoked $event) |
||
22 | { |
||
23 | $device = $event->getDevice()->toArray(); |
||
24 | |||
25 | // device count |
||
26 | DeviceArchive::updateOrCreate( |
||
27 | ['mac_hash' => md5($device['mac'])], |
||
28 | ['updated_at' => Carbon::now()] |
||
29 | ); |
||
30 | |||
31 | // network distribution |
||
32 | $network = ExtractNetwork::fromIp($device['ip']); |
||
33 | DB::table('network_distribution')->where('network', $network)->increment('pokes'); |
||
34 | |||
35 | // pokes |
||
36 | $date = Carbon::now()->toDateString(); |
||
37 | Poke::firstOrCreate(['date' => $date])->increment('pokes'); |
||
38 | } |
||
39 | } |
||
40 |