Skip to content

Instantly share code, notes, and snippets.

@dreamtime
Created November 24, 2014 18:43
Show Gist options
  • Select an option

  • Save dreamtime/6b790e622e8b9d8eceb7 to your computer and use it in GitHub Desktop.

Select an option

Save dreamtime/6b790e622e8b9d8eceb7 to your computer and use it in GitHub Desktop.
public static function createOrUpdate($id = null, array $data)
{
$user = new User;
$user->account_id = $data['account_id'];
$user->role = $data['role'];
$user->email = $data['email'];
$user->username = $data['username'];
$user->password = $data['password'];
$user->password_confirmation = $data['password_confirmation'];
$user->first_name = $data['first_name'];
$user->last_name = $data['last_name'];
$user->phone = $data['phone'];
if(!$user->save())
{
return Redirect::to('register')->withErrors($user->errors()->all());
}
else
{
Auth::login($user, true);
return Redirect::to('/appointments')->with('message', 'Your registration is complete and you are now logged in.');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment