请问自带的注册机制是怎么用 Redis 异步功能,不然邮箱发送太久了

RT

看了源码,好像没有快捷开启的方法,只能重写,重写的话一堆东西不能用。

《L05 电商实战》
从零开发一个电商项目,功能包括电商后台、商品 & SKU 管理、购物车、订单管理、支付宝支付、微信支付、订单退款流程、优惠券等
《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
最佳答案

@Jinrenjie 不是最优解,你这样相当于重写 email
我继续研究了下可以这么写:
app\Models\User 重写 sendEmailVerificationNotification 方法。

public function sendEmailVerificationNotification()
{
     $this->notify(new \App\Notifications\VerifyEmailQueued);
}

创建 VerifyEmailQueued 并继承 VerifyEmail:

php artisan make:notification VerifyEmailQueued

替换以下代码:
<?php

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Auth\Notifications\VerifyEmail;

class VerifyEmailQueued extends VerifyEmail implements ShouldQueue
{
    use Queueable;
    //因为继承了 VerifyEmail,所以可以不用写下面的了,如果想自定义再重写方法即可
}

最后,如果是 homestead 环境,一定要在 homestead 里面测试,一定要在 homestead 里面测试,一定要在 homestead 里面测试。
我在外面死活监听不到,卡了一天。血的教训!!!我一直以为我的 redis 坏了

5年前 评论
讨论数量: 2

App\Http\Controllers\Auth\RegisterController 中重写如下方法:

protected function registered(Request $request, $user)
{
    SendNotify::dispatch($user); // 发送邮件的异步任务
}
5年前 评论

@Jinrenjie 不是最优解,你这样相当于重写 email
我继续研究了下可以这么写:
app\Models\User 重写 sendEmailVerificationNotification 方法。

public function sendEmailVerificationNotification()
{
     $this->notify(new \App\Notifications\VerifyEmailQueued);
}

创建 VerifyEmailQueued 并继承 VerifyEmail:

php artisan make:notification VerifyEmailQueued

替换以下代码:
<?php

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Auth\Notifications\VerifyEmail;

class VerifyEmailQueued extends VerifyEmail implements ShouldQueue
{
    use Queueable;
    //因为继承了 VerifyEmail,所以可以不用写下面的了,如果想自定义再重写方法即可
}

最后,如果是 homestead 环境,一定要在 homestead 里面测试,一定要在 homestead 里面测试,一定要在 homestead 里面测试。
我在外面死活监听不到,卡了一天。血的教训!!!我一直以为我的 redis 坏了

5年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!