예제 #1
0
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     $verif = array('username' => 'required|min:2|unique:utilisateurs', 'password' => 'required|min:2', 'name' => 'required|min:3', 'lastname' => 'required|min:3', 'email' => 'required|email|unique:utilisateurs');
     $validator = Validator::make(Request::all(), $verif);
     if ($validator->fails()) {
         return Redirect::to('inscription')->withErrors($validator);
     } else {
         $request = Request::all();
         $pass = $request['password'];
         $hash = Hash::make($pass);
         $user = Utilisateur::create(['username' => $request['username'], 'password' => $hash, 'name' => $request['name'], 'lastname' => $request['lastname'], 'birthday' => $request['birthday'], 'email' => $request['email']]);
         return redirect('connexion');
     }
 }
예제 #2
0
 /**
  * Show the form for creating a new resource.
  * @param  array $request la requete
  * @return Response
  */
 public function create(Request $request)
 {
     $rules = ['username' => 'required|min:4|alpha_dash|unique:users', 'lastname' => 'required|min:2|alpha', 'firstname' => 'required|min:2|alpha', 'email' => 'required|email|unique:users', 'password' => 'required|min:6', 'birthdate' => 'required|date'];
     $validator = $this->validate($request, $rules);
     $input = Input::all();
     /*$confirmation_code = str_random(20);*/
     /*$input['confirmation_code'] = $confirmation_code;*/
     $input['password'] = Hash::make($input['password']);
     Utilisateur::create($input);
     /*Mail::send('email.verify', $confirmation_code, function($message) {
                 $message->to($input['email'], $input['username'])
                     ->subject('Verification adresse');
             });
     
             Flash::message('Merci de vous etre inscrit.');*/
     return redirect('login')->with('message', 'Vous avez bien été inscrit, Veuillez vous connecter.');
 }