public function show($id)
 {
     $profil = Profil::find($id);
     //echo $profil->user->name;
     $data = array('profil' => $profil);
     return view('profilview', $data);
 }
 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";
 }
 public function show_all_user_post(Request $request)
 {
     $user = Auth::user();
     if ($user->profil->intitule == "administrateur") {
         $key = new Collection();
         if ($request->input('profil')) {
             $key->add(['profil_id', Profil::find($request->input('profil'))->id]);
         }
         if ($request->input('parcours')) {
             $key->add(['parcours_id', Parcours::find($request->input('parcours'))->id]);
         }
         if ($request->input('groupe')) {
             $key->add(['groupe_id', Groupe::find($request->input('groupe'))->id]);
         }
         switch (count($key)) {
             case 1:
                 $users = DB::table('user')->where($key[0][0], '=', $key[0][1])->paginate(8);
                 break;
             case 2:
                 $users = DB::table('user')->where($key[0][0], '=', $key[0][1])->where($key[1][0], '=', $key[1][1])->paginate(8);
                 break;
             case 3:
                 $users = DB::table('user')->where($key[0][0], '=', $key[0][1])->where($key[1][0], '=', $key[1][1])->where($key[2][0], '=', $key[2][1])->paginate(8);
                 break;
             default:
                 $users = DB::table('user')->paginate(8);
         }
         $users->setPath('user');
         //return $users;
         return response()->view('auth/show_all_user', ['users' => $users]);
     }
     return "Vous êtes pas administrateur";
 }