2

I am sorry for the dumb question, but I am new at this programming thing and having fun. How do I get the current user in a base Laravel Spark project? I know what the Laravel Spark documentation says, but I can't seem to get the information even with that. I guess I just need an example. Any help would be appreciated. :)

TytonDon
  • 563
  • 1
  • 5
  • 18

1 Answers1

7

you can access the current authorized user by using the Auth facade. $user = Auth::user(); Make sure to add use Auth; at the top of your file!

Adding on top of this, if you just need something small like the logged-in users's ID, you can say Auth::id()

dargue3
  • 2,802
  • 2
  • 14
  • 23