/** * 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.'); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function delete() { $delete = Utilisateur::where('id', '=', Auth::user()->id)->update(['active' => 0]); Auth::logout(); return redirect('connexion'); }