partial update
This commit is contained in:
parent
3140338ee9
commit
08292c07ab
@ -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
|
* Delete an user
|
||||||
*
|
*
|
||||||
|
@ -34,4 +34,5 @@ Route::group(['middleware' => 'admin'], function ()
|
|||||||
Route::get('admin', 'AdminController@index');
|
Route::get('admin', 'AdminController@index');
|
||||||
Route::post('addUser', 'AdminController@addUser');
|
Route::post('addUser', 'AdminController@addUser');
|
||||||
Route::post('deleteUser', 'AdminController@deleteUser');
|
Route::post('deleteUser', 'AdminController@deleteUser');
|
||||||
|
Route::post('updateUser', 'AdminController@updateUser');
|
||||||
});
|
});
|
@ -24,7 +24,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach ($users as $user)
|
@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))
|
||||||
<form method="POST" role="form" action="deleteUser">
|
<form method="POST" role="form" action="deleteUser">
|
||||||
<input type="hidden" name="idUser" value="{{ $user->id }}">
|
<input type="hidden" name="idUser" value="{{ $user->id }}">
|
||||||
<input type="hidden" name="_token" value="{{{ csrf_token() }}}" />
|
<input type="hidden" name="_token" value="{{{ csrf_token() }}}" />
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<form class="form-horizontal" method="POST" role="form" action="updateUser">
|
<form class="form-horizontal" method="POST" role="form" action="updateUser">
|
||||||
<input type="hidden" name="_token" value="{{{ csrf_token() }}}" />
|
<input type="hidden" name="_token" value="{{{ csrf_token() }}}" />
|
||||||
|
<input type="hidden" name="idUser" value="{{ $me->id }}" />
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="firstname" class="col-sm-2 control-label">Prénom</label>
|
<label for="firstname" class="col-sm-2 control-label">Prénom</label>
|
||||||
@ -54,6 +55,12 @@
|
|||||||
<input type="text" class="form-control" id="city" name="city" required placeholder="Ville" value="{{$me->city}}">
|
<input type="text" class="form-control" id="city" name="city" required placeholder="Ville" value="{{$me->city}}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-2 control-label" for="exampleInputFile">Image</label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<input type="file" id="exampleInputFile">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||||
|
Reference in New Issue
Block a user