| @@ 55-66 (lines=12) @@ | ||
| 52 | $this->insertLog($targetChannel, $targetNick, $message, $timestamp); |
|
| 53 | } |
|
| 54 | ||
| 55 | protected function insertServer($server) |
|
| 56 | { |
|
| 57 | $db = $this->getDatabase(); |
|
| 58 | $targetNetwork = $db->table('networks')->select('id')->where('server', '=', $server)->first(); |
|
| 59 | if ($targetNetwork) { |
|
| 60 | return $targetNetwork->id; |
|
| 61 | } |
|
| 62 | ||
| 63 | return $db->table('networks')->insertGetId([ |
|
| 64 | 'server' => $server, |
|
| 65 | ]); |
|
| 66 | } |
|
| 67 | ||
| 68 | protected function insertChannel($targetNetwork, $channel) |
|
| 69 | { |
|
| @@ 60-74 (lines=15) @@ | ||
| 57 | * @param string $server |
|
| 58 | * @return int |
|
| 59 | */ |
|
| 60 | protected function getNetworkId(Connection $db, $server) |
|
| 61 | { |
|
| 62 | $targetNetwork = $db->table('networks') |
|
| 63 | ->select('id') |
|
| 64 | ->where('server', '=', $server) |
|
| 65 | ->first(); |
|
| 66 | ||
| 67 | if ($targetNetwork) { |
|
| 68 | return $targetNetwork['id']; |
|
| 69 | } else { |
|
| 70 | return $db->table('networks')->insertGetId([ |
|
| 71 | 'server' => $server, |
|
| 72 | ]); |
|
| 73 | } |
|
| 74 | } |
|
| 75 | ||
| 76 | /** |
|
| 77 | * @param \Illuminate\Database\Connection $db |
|