Skip to content

Commit

Permalink
2024.01.22
Browse files Browse the repository at this point in the history
- Se valida si el ID que se obtiene del objeto Identity es numérico para registrarlo directamente o si el Identity proviene de una app móvil entonces obtiene el ID separando el número del valor de este.
  • Loading branch information
Néstor Acevedo committed Jan 22, 2024
1 parent 5b75cb1 commit a0e357d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion neoacevedo/auditing/behaviors/AuditBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ protected function auditAttributes(string $event)
$controllerClass = new \ReflectionClass(Yii::$app->controller);

if ($old_value !== $value) {
$user_id = !Yii::$app->user->isGuest ? explode("-", Yii::$app->user->id)[1] : null;
$user_id = !Yii::$app->user->isGuest ? (is_numeric(Yii::$app->user->id) ? Yii::$app->user->id : explode("-", Yii::$app->user->id)[1]) : null;
$username = !Yii::$app->user->isGuest ? Yii::$app->user->identity->username : 'guess';

$audit = new Auditing();
Expand Down

0 comments on commit a0e357d

Please sign in to comment.