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