/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Requests\UserRegisterRequest $request) { // dd($request->all()); // 保存用户数,重定向 User::create(array_merge($request->all(), ['avatar' => '/images/default-avatar.jpg'])); // send email return redirect('/'); }
public function postRegister(UserRegisterRequest $request) { $request['password'] = bcrypt($request['password']); $user = User::create($request->all()); $user->save(); Auth::login($user); return redirect()->route('home'); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Requests\UserRegisterRequest $request) { $data = ['confirm_code' => str_random(48), 'avatar' => '/images/default-avatar.png']; $user = User::create(array_merge($request->all(), $data)); // send eamil // subject view confirm_code $subject = '马背上的注册提醒右键'; $view = 'email.register'; $this->sendTo($user, $subject, $view, $data); return redirect('/'); }
public function postUserRegister(UserRegisterRequest $request, User $user) { $user->fill($request->all()); $user->password = bcrypt($request->input('password')); $key = config('app.key'); $confirmation_code = hash_hmac('sha256', str_random(40), $key); $user->confirmation_code = $confirmation_code; $user->save(); Mail::send('emails.activate', ['token' => $confirmation_code, 'name' => $user->name], function ($message) use($user) { $message->to($user->getEmailForPasswordReset(), $user->name)->subject('Activate your account'); }); $profile = new Profile(); $profile->user()->associate($user); $profile->save(); $role = Role::where('name', '=', 'user')->first(); if ($role) { $user->attachRole($role->id); } return redirect('/')->withSuccess('User registered successfully.'); }
/** * Store a newly created resource in storage. * * @param UserRegisterRequest $request * @return Response */ public function store(UserRegisterRequest $request) { $input = $request->all(); $this->user->create($input); return redirect('users')->with('message', 'User Registered Successfully'); }