Created
November 24, 2014 18:43
-
-
Save dreamtime/6b790e622e8b9d8eceb7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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