␊ |
␉␉if ($validator->fails()) ␊ |
␉␉{␊ |
␉␉␉return Redirect::to('users/create')␊ |
␉␉␉return Redirect::route('create')␊ |
␉␉␉␉->withErrors($validator) ␊ |
␉␉␉␉->withInput(Input::except('password'));␊ |
␉␉} else ␊ |
|
␊ |
␉␉␉}else␊ |
␉␉␉{␊ |
␉␉␉␉return \Redirect::to('create')->with('errors', 'Something terrible happened');␊ |
␉␉␉␉return \Redirect::route('create')->with('errors', 'Something terrible happened');␊ |
␉␉␉}␊ |
␉␉␉␊ |
␉␉}␊ |
|
␊ |
␉␉if ($user->save()) ␊ |
␉␉{␊ |
␉␉␉return Redirect::route('user', array($user_id));␊ |
␉␉␉return Redirect::route('user');␊ |
␉␉}else␊ |
␉␉{␊ |
␉␉␉\Redirect::back('complete', array($user_id, $group_id ));␊ |
|
␊ |
␉}␊ |
␊ |
␉public function showProfile($id)␊ |
␉public function showProfile()␊ |
␉{␊ |
␉␉$user = Auth::user();␊ |
␊ |
␉␉return View::make('users.profile')->with('user', $user);␊ |
␉}␊ |
␊ |
␉public function showUser($id)␊ |
␉{␊ |
␉␉␊ |
␉␉$user = User::find($id);␊ |
␊ |
␉␉return View::make('users.profile')->with('user', $user);␊ |
|
␉}else␊ |
␉{␊ |
␉␉$user = User::find($id);␊ |
␊ |
␉␉$group = UserXrefRole::where('user_id', '=', $id)->get();␊ |
␊ |
␉␉$group_id = (int)$group[0]->role_id;␊ |
|
␉{␊ |
␉␉$user = User::find($id);␊ |
␊ |
␉␉//update the user here␊ |
␊ |
␉␉\Session::flash('message', 'You have successfully updated your profile.');␊ |
␉␉return Redirect::to('user', array($id));␊ |
␉␉return Redirect::route('user');␊ |
␉}␊ |
␉}␊ |
␊ |