bestmomo / laravel-email-confirmation

Add email confimation to Laravel project
89 stars 28 forks source link

Send Confirmation email outside of Registration #3

Open johnmain opened 7 years ago

johnmain commented 7 years ago

Is there a way to send a Confirmation Email outside of the Registration pages? I have an API method for a 3rd party tool that creates a user. However, I still would like the Email Confirmation email to go out.

bestmomo commented 7 years ago

No way with this package, it's another story.

shiroamada commented 6 years ago

Can't you just copy the registration code and to your new API call output?

        $this->validator($request->all())->validate();

        $user = $this->create($request->all());
        $user->confirmation_code = str_random(30);
        $user->save();

        event(new Registered($user));

        $this->notifyUser($user);

        return back()->with('confirmation-success', trans('confirmation::confirmation.message'));