Skip to content

Instantly share code, notes, and snippets.

@fhulufhelo
Last active August 6, 2019 07:02
Show Gist options
  • Save fhulufhelo/f1c7db144b4375f4192922c3ec84b41f to your computer and use it in GitHub Desktop.
Save fhulufhelo/f1c7db144b4375f4192922c3ec84b41f to your computer and use it in GitHub Desktop.
<?php
namespace App\RegisterUser;
use App\Mail\WelcomeBuyer;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Auth;
use Illuminate\Http\Request;
class RegisterBuyer extends Registering
{
public function handle(Request $request)
{
$user = $this->create($request->all());
// Send welcome email to newly created seller user
Mail::to($user)->send(new WelcomeBuyer($user));
// Login user
$credentials = $request->only('email', 'password');
Auth::attempt($credentials);
// rediect user to dashbord
return redirect()->intended('dashboard.buyer');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment