| Conditions | 4 |
| Paths | 10 |
| Total Lines | 20 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 54 | public function updateOrInsertRecord($user) |
||
| 55 | { |
||
| 56 | try { |
||
| 57 | // regenerate unique id if it's not available |
||
| 58 | $uniqueId = $this->uniqueUserId::isValidUniqueId($user['openemis_no']) ? $this->uniqueUserId::getUniqueAlphanumeric() : $user['openemis_no']; |
||
| 59 | |||
| 60 | //check if the user's entry exits ? |
||
| 61 | $exists = Unique_user_id::where([ |
||
| 62 | 'security_user_id' => $user['id'], |
||
| 63 | 'unique_id' => $uniqueId |
||
| 64 | ])->exists(); |
||
| 65 | if (!$exists) { |
||
| 66 | // try to feed unique user id |
||
| 67 | Unique_user_id::insert([ |
||
| 68 | 'security_user_id' => $user['id'], |
||
| 69 | 'unique_id' => $uniqueId |
||
| 70 | ]); |
||
| 71 | } |
||
| 72 | } catch (\Exception $th) { |
||
| 73 | Log::error($th->getMessage()); |
||
| 74 | } |
||
| 77 |
Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.