当管理员添加用户时,我正在尝试向用户发送信息电子邮件。但我不知道如何干预管理面板中的用户页面?
例如:欢迎“ $user->name
”,您的用户名是“$ user->username
”,密码是“ $user->password
”。
我想了很多。却无法进步。仍然无法发送任何电子邮件。我们有办法让航海者表格中的这个电子邮件系统更容易吗?
编辑:添加了注册控制器
public function register(Request $request)
{
$this->validation($request);
$customer = new Customer();
$customer->name = $request->name;
$customer->surname = $request->surname;
$customer->phone = $request->phone;
$customer->email = $request->email;
$customer->password = bcrypt($request->password);
$customer->description = $request->password;
$customer->save();
Auth::guard('customer')->login($customer);
Session::flash('success', __('messages.success'));
return redirect('/');
编辑:添加 CustomerObserve.php
<?php
namespace App\Helper\Observers;
use App\Customer;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Support\Facades\Mail;
class CustomerObserve implements ShouldQueue
{
public function created()
{
$customer = Customer::latest();
Mail::send('user_login_informations', ['customer' => $customer], function($message) use($customer) {
$message->to($customer->email, $customer->name)
->subject('account update');
})->delay(30);
}
}