I'm having trouble with a form from laravel to create a user. It keeps on saying "The password field is required". I checked the post and the password is filled. I'm using ardent and have this at the beginning of my user model:
public static $passwordAttributes = array('password');
public $autoHashPasswordAttributes = true;
and later on:
function setpasswordAttribute($value)
{
$this->attributes['password'] = Hash::make($value);
}
This is needed to auto hash te password.
Here's the user controller part that handles the post:
public function createUserPost()
{
var_dump(Input::all());
$user = new User(Input::except('locations'));
var_dump($user);
$user->organisation_id = Auth::user()->organisation_id;
// get locations
$input_locations = Input::only('locations');
if($user->save())
{
// Match the id's of location to a new user
$new_user_id = $user->id;
foreach ($input_locations as $key => $value) {
$location = Location::find($value);
User::find($new_user_id)->locations()->attach($location);
}
return Redirect::to('users/'.$user->id);
}
return $this->createUser($user)->withErrors($user);
}
At the var_dump($user) I can also see the password.
Really hope someone can help me out because i'm really stuck here. If I need to put more information I'll be glad to give some.