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