mentors

mentors Commit Details


Date:2014-06-29 01:08:58 (10 years 5 months ago)
Author:Right Or Wrong
Branch:develop
Commit:49f6dcf042f7029f5f08ed668cbb71a1c5f78c40
Parents: 073eb7ec8a48ba97883b19827ac07d2831a1d30b
Message:restrict editing of profiles to logged in owners only

Changes:

File differences

app/controllers/UserController.php
197197
198198
199199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
200230
201231
202232
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()
{
app/routes.php
3131
3232
3333
34
35
3436
3537
3638
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'));

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.05816s using 13 queries.