If we assume that all activity caused by a backpack user is inside backpack admin namespace (crud interface) we could add it in a middleware that checks if the route starts by backpack route prefix.
A middleware seems like something that would be too large of a scope. It would run on all requests, whether it's needed or not. But the idea with the route prefix... THAT I like...
What if we create an Observer for Activity? We can register one in our package's service provider, even if Activity is in the Spatie package. That way... when an activity is created (and only then)... we do some checks.
One way of checking would be:
if route is backpack, use the guard configured in Backpack's config
else use the guard configured in spatie config
That's if we don't have a way to get the currently-active guard... which... we should, right? Laravel should have a getGuard() on the AuthManager or something... right?
_Originally posted by @tabacitu in https://github.com/Laravel-Backpack/activity-log/pull/8#discussion_r1310410449_