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

QUESTION: How is the userid persisted throughout the session? #3506

Closed
cnstanley opened this issue Apr 21, 2017 · 5 comments
Closed

QUESTION: How is the userid persisted throughout the session? #3506

cnstanley opened this issue Apr 21, 2017 · 5 comments

Comments

@cnstanley
Copy link

Hey snipe!

Just a quick question... I am trying to implement some reports in our system, and I need to pass the currently logged in user's ID to the SQL statement. How are you persisting the user id throughout the session?

Thanks!

@snipe
Copy link
Owner

snipe commented Apr 22, 2017

I'm not sure I understand the question - are you adding functionality to the Snipe-IT core? If so, you can use Auth::user()->id

@cnstanley
Copy link
Author

Basically I am wanting to run a query: SELECT * FROM assets WHERE assigned_to = [logged in user ID], so that my end users can easily run a report that shows all assets assigned to them. So is the logged-in user ID stored in Auth::user()->id?

@snipe
Copy link
Owner

snipe commented Apr 25, 2017

I understand that, but from where are you running this? Are you writing code for Snipe-IT, or trying to run something outside of the Snipe-IT core?

@snipe
Copy link
Owner

snipe commented Apr 25, 2017

So is the logged-in user ID stored in Auth::user()->id?

If you're running the code within the Snipe-IT core, Auth::user()->id will return the currently logged in user's ID

@cnstanley
Copy link
Author

perfect! I'll give that a shot and see if I can get it to work! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants