mentors

mentors Commit Details


Date:2014-06-29 23:59:15 (10 years 5 months ago)
Author:Right Or Wrong
Branch:develop
Commit:449266787cf1def7189c4a25f79e5ff4d0623e33
Parents: b2ff5abcaec72b58b7e47e8dfba5a809ce5b6386
Message:currently logged in users have no id in url just goes to /user/profile instead

Changes:

File differences

app/controllers/HomeController.php
1919
2020
2121
22
22
2323
2424
2525
{
if(Auth::check())
{
return Redirect::route('user', Auth::id());
return Redirect::route('user');
}
return View::make('home');
app/controllers/SessionController.php
77
88
99
10
10
1111
1212
1313
......
6969
7070
7171
72
7273
74
7375
7476
7577
{
if(Auth::check())
{
return Redirect::route('user', Auth::id());
return Redirect::route('user');
}
return View::make('login');
public function doLogout()
{
Auth::logout();
return Redirect::to('login');
Session::forget('user');
}
app/controllers/UserController.php
2929
3030
3131
32
32
3333
3434
3535
......
4949
5050
5151
52
52
5353
5454
5555
......
182182
183183
184184
185
185
186186
187187
188188
......
190190
191191
192192
193
193
194194
195
196
197
198
199
200
201
202
195203
196204
197205
......
205213
206214
207215
216
208217
209218
210219
......
222231
223232
224233
234
235
225236
226
237
227238
228239
229240
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');
}
}
app/filters.php
8383
8484
8585
86
86
8787
8888
8989
{
if(Auth::check() && Auth::user()->level != 'admin')
{
\Session::flash('message', 'You tried to access restricted area!');
\Session::flash('message', 'You tried to access a restricted area!');
return Redirect::to('denied');
}
});
app/routes.php
3030
3131
3232
33
33
34
3435
3536
3637
Route::get('users/group/{user_id}', array('as' => 'group', 'uses' => 'UserController@chooseGroup'));
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('user/{id}', array('as' => 'user', 'uses' => 'UserController@showProfile'));
Route::get('user/profile', array('as' => 'user', 'uses' => 'UserController@showProfile'));
Route::get('user/{id}', array('as' => 'usr', 'uses' => 'UserController@showUser'));
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'));
app/views/users/index.blade.php
6262
6363
6464
65
65
6666
6767
6868
<td>{{ $value->location }}</td>
<td>{{ $value->bio }}</td>
<td>
<a class="btn btn-small btn-primary" href="{{ URL::to('users/' . $value->id) }}">View this Nerd</a>
<a class="btn btn-small btn-primary" href="{{ URL::to('user/' . $value->id) }}">View this Nerd</a>
</td>
</tr>
@endforeach

Archive Download the corresponding diff file

Branches

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