mercredi 23 novembre 2016

Send notification email to user ? Laravel 5.3

I have this scenario in my app, where newly registered user will receive an email message that their account has been created (this message will contains their username and password). How to do it in Laravel ? especially Laravel 5.3. I have created the controller to store new users, I want the email will send right away when new user is stored.

public function store(Request $request) {
        $data = $request->all();
        $validasi = Validator::make($data, [
                    'name' => 'required|max:255',
                    'username' => 'required|max:255|unique:users',
                    'email' => 'required|email|max:150|unique:users',
                    'password' => 'required|confirmed|min:6',
                    'level' => 'required|in:admin,author',
        ]);
        if ($validasi->fails()) {
            return redirect('user/create')->withInput()->withErrors($validasi);
        }
        $data['password'] = bcrypt($data['password']);
        User::create($data);
        return redirect('user');
    }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire