Skip to content
Discussion options

You must be logged in to vote

I solved it by creating a middleware and registering it on the kernel.
the middleware to get all guards and check to which one auth and set it as a default driver.

public function handle(Request $request, Closure $next)
{
    $list = array_keys(config('auth.guards'));

    foreach ($list as $guard) {
        if (auth($guard)->check()) {
            config(['activitylog.default_auth_driver' => $guard]);
        }
    }

    return $next($request);
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mahmoudabdelhalim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant