Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add API for setting user, default to pulling from request #19

Open
hlo2109 opened this issue Aug 29, 2021 · 1 comment
Open

Add API for setting user, default to pulling from request #19

hlo2109 opened this issue Aug 29, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@hlo2109
Copy link

hlo2109 commented Aug 29, 2021

Hello, I would like to add the user id based on a url but I don't see how to do it.

if ($project) {
$ userId = $ project-> user_id;
}

@owenconti
Copy link
Member

Hi @hlo2109

The package doesn't provide an API for that right now. The only way around it is to either:

  • Change $request->user() to return the user you want (but this may effect other areas of your application)
  • Add a event listener to the Analytics model and change the user_id property before the model is saved

See this line for how the user is set currently: https://github.com/ohseesoftware/laravel-server-analytics/blob/master/src/LaravelServerAnalytics.php#L240

@owenconti owenconti added the enhancement New feature or request label Aug 29, 2021
@owenconti owenconti changed the title Change id user , not login Add API for setting user, default to pulling from request Aug 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants