diff --git a/SRC/app/Http/Controllers/AdminController.php b/SRC/app/Http/Controllers/AdminController.php index cb3afed..f577628 100755 --- a/SRC/app/Http/Controllers/AdminController.php +++ b/SRC/app/Http/Controllers/AdminController.php @@ -49,6 +49,27 @@ class AdminController extends Controller { } + + /** + * updateUser an user in database. + * + * + */ + public function updateUser() + { + $user = User::find(Input::get('idUser')); + + $user->firstname = Input::get('firstname'); + $user->email = Input::get('email'); + $user->city = Input::get('city'); + $user->lastname = Input::get('lastname'); + //$user->image = "pictures/user_picture/default.png"; + + $user->save(); + return redirect('/admin')->with('message_update', 'Referent mis à jour avec succès'); + } + + /** * Delete an user * diff --git a/SRC/app/Http/routes.php b/SRC/app/Http/routes.php index 19f178e..ae401ab 100755 --- a/SRC/app/Http/routes.php +++ b/SRC/app/Http/routes.php @@ -34,4 +34,5 @@ Route::group(['middleware' => 'admin'], function () Route::get('admin', 'AdminController@index'); Route::post('addUser', 'AdminController@addUser'); Route::post('deleteUser', 'AdminController@deleteUser'); + Route::post('updateUser', 'AdminController@updateUser'); }); \ No newline at end of file diff --git a/SRC/resources/views/admin.blade.php b/SRC/resources/views/admin.blade.php index 0d332df..219b404 100755 --- a/SRC/resources/views/admin.blade.php +++ b/SRC/resources/views/admin.blade.php @@ -24,7 +24,7 @@
@foreach ($users as $user) - @if ($user->droits != 2 && $user != $me || ($user->droits != 0 && $me->droits == 2)) + @if ($user->droits != 2 && $user != $me || ($user->droits != 0 && $me->droits == 2 && $user != $me))