Hi, gang. I am new to Laravel and I am trying to figure out the best way to accomplish something which I thought would be simple.
I have a class that requires a user id as a parameter. I have it registered as a singleton in the service container. I cannot figure out how to provide the current logged-in user's id to the singleton unless I use a method on the class to pass Auth::id() to the class as a parameter from the controller's method. I have tried using middleware but Auth::id() seems to be empty until after the controller's first non-constructor method gets hit. Does anybody know a way for me to accomplish my goal?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community