upload picture
This commit is contained in:
parent
d8cdb49746
commit
3425dc66d9
@ -4,6 +4,7 @@ use App\User;
|
||||
use Input;
|
||||
use Auth;
|
||||
use Session;
|
||||
use Request;
|
||||
|
||||
class AdminController extends Controller {
|
||||
|
||||
@ -59,13 +60,21 @@ class AdminController extends Controller {
|
||||
*/
|
||||
public function updateUser()
|
||||
{
|
||||
$user = User::find(Input::get('idUser'));
|
||||
|
||||
$idUser = Input::get('idUser');
|
||||
$user = User::find($idUser);
|
||||
|
||||
if (Request::hasFile('file'))
|
||||
{
|
||||
Request::file('file')->move("./pictures/user_picture/", $idUser);
|
||||
$user->image = "pictures/user_picture/".$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', 'User mis à jour avec succès');
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
use App\User;
|
||||
use Input;
|
||||
use Request;
|
||||
|
||||
class ReferentController extends Controller {
|
||||
|
||||
@ -35,7 +36,15 @@ class ReferentController extends Controller {
|
||||
*/
|
||||
public function update()
|
||||
{
|
||||
$user = User::find(Input::get('idUser'));
|
||||
$idUser = Input::get('idUser');
|
||||
$user = User::find($idUser);
|
||||
|
||||
if (Request::hasFile('file'))
|
||||
{
|
||||
Request::file('file')->move("./pictures/user_picture/", $idUser);
|
||||
$user->image = "pictures/user_picture/".$idUser;
|
||||
}
|
||||
|
||||
|
||||
$user->firstname = Input::get('firstname');
|
||||
$user->email = Input::get('email');
|
||||
|
BIN
SRC/public/pictures/user_picture/2
Normal file
BIN
SRC/public/pictures/user_picture/2
Normal file
Binary file not shown.
After Width: | Height: | Size: 394 KiB |
BIN
SRC/public/pictures/user_picture/3
Normal file
BIN
SRC/public/pictures/user_picture/3
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
@ -4,7 +4,7 @@
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Laravel</title>
|
||||
<title>ModuleWeb</title>
|
||||
|
||||
<link href="/css/app.css" rel="stylesheet">
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
||||
@endif
|
||||
<br>
|
||||
<a href="/referents/vive.linux/games"><img style="border: 7px solid white; box-shadow: 0px 0px 3px black;" src="./pictures/referent/francois.jpg" width="35%" alt="{{ $ref -> name }}-Nom"></a>
|
||||
<div class="well well-lg">{{$ref -> name}}, Nom</div>
|
||||
<div class="well well-lg">{{$ref -> firstname}}, {{$ref -> lastname}}</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
@ -31,7 +31,7 @@
|
||||
<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>
|
||||
</div>
|
||||
<form class="form-horizontal" method="POST" role="form" @if ($me->droits == 0) action="update" @else action="updateUser" @endif>
|
||||
<form @if ($me->droits == 0) action="update" @else action="updateUser" @endif method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="_token" value="{{{ csrf_token() }}}" />
|
||||
<input type="hidden" name="idUser" value="{{ $me->id }}" />
|
||||
<div class="modal-body">
|
||||
@ -60,11 +60,11 @@
|
||||
</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>
|
||||
<label class="col-sm-2 control-label" for="exampleInputFile">Image</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="file" name="file" id="file">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
|
Reference in New Issue
Block a user