I have a register form on my project in Laravel 4, and when I do the register, I'm redirected to the login page. Also, my view detects when the user reached the login page from the register page and show a message to thank him. I would like to send one more data (the e-mail address he inserted in the register form) to fill the email field (the username is the email address).
The code on the controller is like:
return Redirect::to('login')->withMessage('<h3 style="color: #FFFFFF;">message here</h3>');
And I would like to do something like that:
return Redirect::to('login')->withData('email', $data['email'])->withMessage('<h3 style="color: #FFFFFF;">message here</h3>');
Is that possible? Thank you all.
Yes that can be done, but you have to change it a little bit.
Either use:
->withData(array('email' => $data['email']))
Or:
->withEmail($data['email']);
And here's how you retrieve it:
$email = Session::get('data.email');
Or:
$email = Session::get('email');