Merge branch 'master' of https://github.com/matthieupenchenat81/ModuleWeb
@ -68,3 +68,15 @@ git pull
|
||||
exit
|
||||
git pull
|
||||
exit
|
||||
git pull
|
||||
git status
|
||||
git add .
|
||||
git commit -m "admin view & navbar_signed"
|
||||
git push
|
||||
git pull
|
||||
exit
|
||||
git pull
|
||||
exit
|
||||
cd ..
|
||||
ls
|
||||
nano loadCSVAugustin2014.py
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php namespace App\Http\Controllers;
|
||||
|
||||
use App\User;
|
||||
use Input;
|
||||
|
||||
class AdminController extends Controller {
|
||||
|
||||
@ -34,11 +35,30 @@ class AdminController extends Controller {
|
||||
*/
|
||||
public function addUser()
|
||||
{
|
||||
$firstname = Request::input('firstname');
|
||||
$lastname = Input::get('lastname');
|
||||
$email = Input::get('email');
|
||||
$city = Input::get('city');
|
||||
//print('ok');
|
||||
$user = new User;
|
||||
|
||||
$user->firstname = Input::get('firstname');
|
||||
$user->email = Input::get('email');
|
||||
$user->admin = 0;
|
||||
$user->city = Input::get('city');
|
||||
$user->lastname = Input::get('lastname');
|
||||
$user->image = "pictures/user_picture/default.png";
|
||||
|
||||
$user->save();
|
||||
return redirect('/admin')->with('message_add', 'Referent ajouté avec succès');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete an user
|
||||
*
|
||||
*/
|
||||
public function deleteUser()
|
||||
{
|
||||
$idUser = Input::get('idUser');
|
||||
$user = User::find($idUser);
|
||||
$user->delete();
|
||||
return redirect('/admin')->with('message_delete', 'Referent supprimé avec succès');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ class RedirectIfNotAdmin {
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if (!$this->auth->check() OR Auth::user()->admin == 0)
|
||||
if (!$this->auth->check() OR Auth::user()->droit == 0)
|
||||
{
|
||||
return new RedirectResponse(url('/login'));
|
||||
}
|
||||
|
@ -33,5 +33,5 @@ Route::group(['middleware' => 'admin'], function ()
|
||||
{
|
||||
Route::get('admin', 'AdminController@index');
|
||||
Route::post('addUser', 'AdminController@addUser');
|
||||
});
|
||||
|
||||
Route::post('deleteUser', 'AdminController@deleteUser');
|
||||
});
|
@ -27,10 +27,12 @@ class UserTableSeeder extends Seeder {
|
||||
//DB::table('users')->truncate();
|
||||
|
||||
$user = array(
|
||||
'name' => 'admin',
|
||||
'firstname' => 'admin',
|
||||
'lastname' => 'admin',
|
||||
'city' => 'Montauban',
|
||||
'email' => 'admin@admin.com',
|
||||
'password' => Hash::make('admin'),
|
||||
'image' => '',
|
||||
'image' => 'pictures/user_picture/default.png',
|
||||
'admin' => '1'
|
||||
);
|
||||
|
||||
@ -38,10 +40,12 @@ class UserTableSeeder extends Seeder {
|
||||
DB::table('users')->insert($user);
|
||||
|
||||
$user = array(
|
||||
'name' => 'ref',
|
||||
'lastname' => 'ref',
|
||||
'firstname' => 'ref',
|
||||
'city' => 'Toulouse',
|
||||
'email' => 'ref@ref.com',
|
||||
'password' => Hash::make('ref'),
|
||||
'image' => '',
|
||||
'image' => 'pictures/user_picture/default.png',
|
||||
'admin' => '0'
|
||||
);
|
||||
|
||||
|
Before Width: | Height: | Size: 311 KiB |
Before Width: | Height: | Size: 219 KiB |
Before Width: | Height: | Size: 79 KiB |
Before Width: | Height: | Size: 128 KiB |
Before Width: | Height: | Size: 157 KiB |
Before Width: | Height: | Size: 34 KiB |
BIN
SRC/public/pictures/user_picture/default.png
Executable file
After Width: | Height: | Size: 3.7 KiB |
@ -2,6 +2,9 @@
|
||||
|
||||
@section('content')
|
||||
|
||||
{{ Session::get('message_add') }}
|
||||
{{ Session::get('message_delete') }}
|
||||
|
||||
<br>
|
||||
<div class="col-md-2"></div>
|
||||
|
||||
@ -12,21 +15,33 @@
|
||||
<thead>
|
||||
<tr style="background-color: #F7BE81">
|
||||
<td>Nom</td>
|
||||
<td>Prénom</td>
|
||||
<td>Mail</td>
|
||||
<td>Lieu</td>
|
||||
<td>Type</td>
|
||||
<td>Se connecter</td>
|
||||
<td>Supprimer</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($users as $user)
|
||||
<form method="POST" role="form" action="deleteUser">
|
||||
<input type="hidden" name="idUser" value="{{ $user->id }}">
|
||||
<input type="hidden" name="_token" value="{{{ csrf_token() }}}" />
|
||||
<tr style="background-color: #F6E3CE">
|
||||
<td>{{$user->name}}</td>
|
||||
<td>{{$user->firstname}}</td>
|
||||
<td>{{$user->lastname}}</td>
|
||||
<td>{{$user->email}}</td>
|
||||
<td>Toulouse</td>
|
||||
<td><a href="#" class="btn btn-sm btn-success"><span class="glyphicon glyphicon-ok"></span></a></td>
|
||||
<td><a href="#" class="btn btn-sm btn-danger"><span class="glyphicon glyphicon-trash"></span></a></td>
|
||||
<td>{{$user->city}}</td>
|
||||
@if ($user->admin == 0)
|
||||
<td>Référent</td>
|
||||
@else
|
||||
<td>Admin</td>
|
||||
@endif
|
||||
<td><a href="#" class="btn btn-sm btn-success"><span class="glyphicon glyphicon-log-in"></span></a></td>
|
||||
<td><button type="submit" class="btn btn-sm btn-danger"><span class="glyphicon glyphicon-trash"></span></a></td>
|
||||
</tr>
|
||||
</form>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@ -42,37 +57,45 @@
|
||||
<h4 class="modal-title" id="myModalLabel">Créer un nouvel adhérent</h4>
|
||||
</div>
|
||||
<form class="form-horizontal" method="POST" role="form" action="addUser">
|
||||
<input type="hidden" name="_token" value="{{{ csrf_token() }}}" />
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label for="firstname" class="col-sm-2 control-label">Prénom</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" id="firstname" name="firstname" placeholder="Prénom">
|
||||
<input type="text" class="form-control" id="firstname" name="firstname" required placeholder="Prénom">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="lastname" class="col-sm-2 control-label">Nom</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" id="lastname" placeholder="Nom">
|
||||
<input type="text" class="form-control" id="lastname" name="lastname" required placeholder="Nom">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="email" class="col-sm-2 control-label">Email</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="email" class="form-control" id="email" placeholder="Email">
|
||||
<input type="email" class="form-control" id="email" name="email" required placeholder="Email">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="city" class="col-sm-2 control-label">Ville</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" id="city" placeholder="Ville">
|
||||
<input type="text" class="form-control" id="city" name="city" required placeholder="Ville">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input name="isadmin" type="checkbox"> Est administrateur
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-primary">Enregistrer</button>
|
||||
<button type="submit" class="btn btn-primary">Enregistrer</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
@ -1,12 +1,19 @@
|
||||
<nav class="navbar navbar-default">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="#">Espace {{ $nameRoute }}</a>
|
||||
<!-- <span class="glyphicon glyphicon-user" aria-hidden="true"></span> -->
|
||||
<p class="navbar-text"><img height="50" weight="50" src="{{$me->image}}"></img> </p>
|
||||
<p class="navbar-text">{{$me->name}}</p>
|
||||
<p class="navbar-text"><img height="25" weight="25" src="{{$me->image}}"></img> </p>
|
||||
<p class="navbar-text">{{$me->firstname}}</p>
|
||||
<p class="navbar-text">{{$me->lastname}}</p>
|
||||
<p class="navbar-text">{{$me->email}}</p>
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li><a href="logout">Se déconnecter</a></li>
|
||||
<li>
|
||||
<a href="logout">Se déconnecter</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li>
|
||||
<a href="">Mes paramètres</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|