update user settings
This commit is contained in:
parent
08292c07ab
commit
dea56f3c8c
@ -45,7 +45,7 @@ class AdminController extends Controller {
|
|||||||
$user->image = "pictures/user_picture/default.png";
|
$user->image = "pictures/user_picture/default.png";
|
||||||
|
|
||||||
$user->save();
|
$user->save();
|
||||||
return redirect('/admin')->with('message_add', 'Referent ajouté avec succès');
|
return redirect('/admin')->with('message_add', 'User ajouté avec succès');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ class AdminController extends Controller {
|
|||||||
//$user->image = "pictures/user_picture/default.png";
|
//$user->image = "pictures/user_picture/default.png";
|
||||||
|
|
||||||
$user->save();
|
$user->save();
|
||||||
return redirect('/admin')->with('message_update', 'Referent mis à jour avec succès');
|
return redirect('/admin')->with('message_update', 'User mis à jour avec succès');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ class AdminController extends Controller {
|
|||||||
$idUser = Input::get('idUser');
|
$idUser = Input::get('idUser');
|
||||||
$user = User::find($idUser);
|
$user = User::find($idUser);
|
||||||
$user->delete();
|
$user->delete();
|
||||||
return redirect('/admin')->with('message_delete', 'Referent supprimé avec succès');
|
return redirect('/admin')->with('message_delete', 'User supprimé avec succès');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<?php namespace App\Http\Controllers;
|
<?php namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\User;
|
use App\User;
|
||||||
|
use Input;
|
||||||
|
|
||||||
class ReferentController extends Controller {
|
class ReferentController extends Controller {
|
||||||
|
|
||||||
@ -27,4 +28,22 @@ class ReferentController extends Controller {
|
|||||||
return view('referent', ['nameRoute' => 'Référent', 'me' => $me]);
|
return view('referent', ['nameRoute' => 'Référent', 'me' => $me]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* updateUser an user in database.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function update()
|
||||||
|
{
|
||||||
|
$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->save();
|
||||||
|
return redirect('/referent')->with('message_update', 'Referent mis à jour avec succès');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ Route::group(['middleware' => 'auth'], function ()
|
|||||||
{
|
{
|
||||||
Route::get('referent', 'ReferentController@index');
|
Route::get('referent', 'ReferentController@index');
|
||||||
Route::get('logout', 'LoginController@logout');
|
Route::get('logout', 'LoginController@logout');
|
||||||
|
Route::post('update', 'ReferentController@update');
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::group(['middleware' => 'admin'], function ()
|
Route::group(['middleware' => 'admin'], function ()
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
<li>
|
<li>
|
||||||
<a data-toggle="modal" data-target="#myModal1">Mes paramètres</a>
|
<a data-toggle="modal" data-target="#myModal1">Mes paramètres</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
@ -27,7 +27,7 @@
|
|||||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||||
<h4 class="modal-title" id="myModalLabel">Informations personnelles</h4>
|
<h4 class="modal-title" id="myModalLabel">Informations personnelles</h4>
|
||||||
</div>
|
</div>
|
||||||
<form class="form-horizontal" method="POST" role="form" action="updateUser">
|
<form class="form-horizontal" method="POST" role="form" @if ($me->droits == 0) action="update" @else action="updateUser" @endif>
|
||||||
<input type="hidden" name="_token" value="{{{ csrf_token() }}}" />
|
<input type="hidden" name="_token" value="{{{ csrf_token() }}}" />
|
||||||
<input type="hidden" name="idUser" value="{{ $me->id }}" />
|
<input type="hidden" name="idUser" value="{{ $me->id }}" />
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
Reference in New Issue
Block a user