I'm new to laravel and am trying to play around with it's features. However, I'm stuck on being able to use the $username
variable
In my UserController
class I have the following method:
public function handleRegister()
{
$user = new User();
$user->email = Input::get('email');
$user->username = Input::get('username');
$user->password = Hash::make(Input::get('password'));
$user->save();
return Redirect::to('login')->withInput(array('username', $user->username));
}
This portion of my code works perfectly since when I var_dump(Input::Old())
using 'Jon' as the username, the following is returned for /login:
array(2) { [0]=> string(8) "username" [1]=> string(3) "Jon" }
For the username input field for /login, I attempt to use the value using:
value="{{ Input::old('username') or '' }}"
However, the input field's value is always ''.
What am I doing wrong?
UPDATE:
After chaning the return value to the following:
return Redirect::to('login')->withInput(Input::only('username'));
and attempting to retrieve the value:
value="{{ Input::old('username') }}
Instead of 'Jon', the username field's value is set to 1.
I have no idea why.