diff --git a/app/controllers/UserController.php b/app/controllers/UserController.php index c7b4936..a17a2d9 100644 --- a/app/controllers/UserController.php +++ b/app/controllers/UserController.php @@ -197,6 +197,36 @@ class UserController extends \BaseController return View::make('users.profile')->with('user', $user); } + public function edit($id) + { + if( Auth::check() && Auth::user()->id != $id) + { + return Redirect::to('/'); + }else + { + $user = User::find($id); + $group = UserXrefRole::where('user_id', '=', $id)->get(); + + $group_id = (int)$group[0]->role_id; + + return View::make('users.complete')->with('user', $user)->with('group_id', $group_id); + } + } + + public function update($id) + { + if( Auth::check() && Auth::user()->id != $id) + { + return Redirect::to('/'); + }else + { + $user = User::find($id); + + \Session::flash('message', 'You have successfully updated your profile.'); + return Redirect::to('users', array($id)); + } + } + public function mentors() { diff --git a/app/routes.php b/app/routes.php index 6047670..361cfee 100755 --- a/app/routes.php +++ b/app/routes.php @@ -31,6 +31,8 @@ Route::group(array('before' => 'auth'), function() Route::get('users/group/{user_id}/{group_id}', array('as' => 'complete', 'uses' => 'UserController@completeRegistration')); Route::post('users/group/complete', array('uses' => 'UserController@saveProfile')); Route::get('users/{id}', array('as' => 'users', 'uses' => 'UserController@showProfile')); + Route::get('users/{id}/edit', array('as' => 'edit', 'uses' => 'UserController@edit')); + Route::put('users/{id}/update', array('uses' => 'UserController@update')); Route::get('users', array('as' => 'users', 'uses' => 'UserController@index')); Route::get('mentors', array('as' => 'mentors', 'uses' => 'UserController@mentors')); Route::get('mentees', array('as' => 'mentees', 'uses' => 'UserController@mentees')); diff --git a/public/images/users/profile_53afad361a848.JPG b/public/images/users/profile_53afad361a848.JPG new file mode 100644 index 0000000..52af230 Binary files /dev/null and b/public/images/users/profile_53afad361a848.JPG differ