| Total Complexity | 8 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class ApiKeysRepository |
||
| 8 | { |
||
| 9 | public function incrementHit($serverSecret) |
||
| 10 | { |
||
| 11 | return $this->where(['secretkey' => $serverSecret])->increment('hit'); |
||
| 12 | } |
||
| 13 | |||
| 14 | public function where($where) |
||
| 15 | { |
||
| 16 | return $this->table()->where($where); |
||
| 17 | } |
||
| 18 | |||
| 19 | private static function table() |
||
| 20 | { |
||
| 21 | return DB::table('cms_apikey'); |
||
| 22 | } |
||
| 23 | |||
| 24 | public function getSecretKeys() |
||
| 25 | { |
||
| 26 | return $this->where(['status' => 'active'])->pluck('secretkey'); |
||
| 27 | } |
||
| 28 | |||
| 29 | public function get() |
||
| 30 | { |
||
| 31 | return $this->table()->get(); |
||
| 32 | } |
||
| 33 | |||
| 34 | public function deleteById($id) |
||
| 35 | { |
||
| 36 | return $this->where(['id' => $id])->delete(); |
||
| 37 | } |
||
| 38 | |||
| 39 | public function updateById($status, $id) |
||
| 42 | } |
||
| 43 | |||
| 44 | public function insertGetId($token) |
||
| 45 | { |
||
| 46 | return $this->table()->insertGetId([ |
||
| 47 | 'secretkey' => $token, |
||
| 48 | 'created_at' => YmdHis(), |
||
| 53 | } |