Booshlub
210
10
Laravel

How to change the login functionality to pass a variable with the login

Posted 1 month ago by Booshlub

So I am trying to set up my site so that when you log in, you are immediately taken to a page that will load a bunch of values from the database. The problem is I'm not sure how to accomplish this using the LoginController. In the login controller I see that this line redirects the user to home: protected $redirectTo = '/home'; But I can't compact a variable with that line to send to home because compact needs to be in parentheses with the view like: return view('post', compact('post', 'comments')); for example.

So how can I alter the login controller functionality to allow me to compact a variable to the home page? Thanks in advance!

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.