亲爱的拉维勒/斯帕克斯,
我正在将一个旧的spark项目转换为最新版本。在我目前的版本中,我会在新用户注册到我的网站后给他们发邮件。为此,我创建了这个类:
namespace App\listeners;
use Laravel\Spark\Events\Auth\UserRegistered;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailer;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Log;
use Illuminate\Foundation\Bus\DispatchesJobs;
class HookRegisteredUser
{
use DispatchesJobs;
public function handle(UserRegistered $event)
{
$welcomeMail = new \App\Mail\Welcome($event->user);
Mail::to($event->user->email)
->send($welcomeMail);
}
}
接下来,我在app\providers\eventserviceprovider中注册这个类:
<?PHP
namespace App\Providers;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
*
* @var array
*/
protected $listen = [
// User Related Events...
'Laravel\Spark\Events\Subscription\UserSubscribed' => [
'App\listeners\HookRegisteredUser',
'Laravel\Spark\Listeners\Subscription\UpdateActiveSubscription',
'Laravel\Spark\Listeners\Subscription\UpdateTrialEndingDate',
],
然而,什么也没发生。有没有一种新的方法用于更新的laravel/spark版本?还是我可以试试别的?
暂无答案!
目前还没有任何答案,快来回答吧!