Skip to content

Commit 88bc96e

Browse files
committed
Update Actionable.php
1 parent 3eb4dcb commit 88bc96e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Traits/Actionable.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Binafy\LaravelUserMonitoring\Utills\ActionType;
66
use Binafy\LaravelUserMonitoring\Utills\Detector;
7+
use Binafy\LaravelUserMonitoring\Utills\UserUtils;
78
use Illuminate\Support\Facades\DB;
89

910
trait Actionable
@@ -64,16 +65,16 @@ protected static function boot(): void
6465
private static function insertActionMonitoring(mixed $model, string $actionType): void
6566
{
6667
$detector = new Detector;
67-
$guard = config('user-monitoring.user.guard');
6868

6969
DB::table(config('user-monitoring.action_monitoring.table'))->insert([
70-
'user_id' => auth($guard)->id(),
70+
'user_id' => UserUtils::getUserId(),
7171
'action_type' => $actionType,
7272
'table_name' => $model->getTable(),
7373
'browser_name' => $detector->getBrowser(),
7474
'platform' => $detector->getDevice(),
7575
'device' => $detector->getDevice(),
7676
'ip' => self::getRealIP(),
77+
'user_guard' => UserUtils::getCurrentGuardName(),
7778
'page' => request()->url(),
7879
'created_at' => now(),
7980
'updated_at' => now(),

0 commit comments

Comments
 (0)