예제 #1
0
 public function show($id)
 {
     $profil = Profil::find($id);
     //echo $profil->user->name;
     $data = array('profil' => $profil);
     return view('profilview', $data);
 }
예제 #2
0
 public function update_profil_post(Request $request, $id)
 {
     $user = Auth::user();
     if ($user->profil->intitule == "administrateur") {
         $erreurs = new Collection();
         $this->validate($request, ['intitule' => 'required']);
         $profils = Profil::all();
         $profil = Profil::find($id);
         foreach ($profils as $p) {
             if ($request->input('intitule') != $profil->intitule) {
                 if ($request->input('intitule') == $p->intitule) {
                     $erreurs->prepend("Cet intitulé existe déjà !");
                     break;
                 }
             }
         }
         $profil->intitule = $request->input('intitule');
         if (count($erreurs) > 0) {
             return response()->view('profil/update_profil', ['profil' => $profil, 'erreurs' => $erreurs]);
         }
         $profil->save();
         return redirect('admin/profil');
     }
     return "Vous êtes pas administrateur";
 }
예제 #3
0
 public function delete_all()
 {
     $user = Auth::user();
     if ($user->profil->intitule == "administrateur") {
         $profil_id = Profil::where('intitule', '=', 'étudiant')->get()->first()->intitule;
         User::where('profil_id', '=', $profil_id)->delete();
         return redirect('admin/user');
     }
     return "Vous êtes pas administrateur";
 }
예제 #4
0
        <h2>PAGE DE GESTION DES UTILISATEURS</h2>

        <div style="position:fixed; z-index:100000; display:none;" id="filtrage" class="col-sm-offset-3 col-sm-6">
            <div class="panel panel-info">
                <div class="panel-heading">CHOIX DE PROFIL
                    {!! Form::open(['url' => 'admin/user']) !!}
                </div>


                <div class="panel-heading">Type de profil</div>
                <div class="panel-body">
                    <div class="form-group">
                        <select onChange="checkProfil(this);" name="profil">
                            <option value="0">Choissir tout</option>
                            <?php 
$profils = \App\Profil::all();
?>
                            @if (isset($profils))
                                @foreach ($profils as $profil)
                                    <option value="{{ $profil->id }}">{{ $profil->intitule }}</option>
                                @endforeach
                            @endif
                        </select>
                    </div>
                </div>


                <div id="parcours1" class="panel-heading">Année suivie</div>
                <div id="parcours2" class="panel-body">
                    <div class="form-group">
                        <select name="parcours">
예제 #5
0
 public function store(Request $request)
 {
     $profil = Profil::create($request->all());
     return response()->json(['message' => 'Profil Created Succesfully!', 'data' => $this->transform($profil)]);
 }