내 코드는Laravel 알림 이메일 외관 큐 여러 사용자가 여기에
$users = User::whereIn('id', $userIds)->get();
\Notification::send($users, new DealPublished($deal));
그것은 작동하지만 내가 그
$users = User::whereIn('id', $userIds)->get();
$when = Carbon::now()->addSecond();
\Notification::send($users, new DealPublished($deal))->when($when);
오류처럼 지연 할 경우
입니다 여러 사용자에게 알림 이메일을 전송하기 위해 노력하고 있습니다FatalThrowableError in DealController.php line 226:
Call to a member function when() on null
대기열 및 알림을 사용하여 여러 사용자에게 알림 이메일을 보내려면 어떻게해야합니까? 케드? 도움
''when'을'delay'로 바꾸고 다시 시도하십시오. – EddyTheDove
DealController.php의 FatalThrowableError 라인 226 : null에 대한 멤버 함수 delay() 호출 – user2916349
알림을 대기열에 넣으려면 https://laravel.com/에서 언급 한 것처럼 'ShouldQueue' 인터페이스와'Queuable '특성을 추가하십시오. docs/5.3/notifications # queuing-notifications. 그러나 그것은 당신이 특정 시간 (1 초)에 대한 알림을 예약/지연하려는 것 같습니다. doc을 참조하면,'delay'는'notify'에만 적용됩니다. 불행하게도, 배열로 호출 할 수는 없지만 사용자 당 호출 할 수는 있습니다. 어쩌면 for 루프일까요? 그냥 제안 해. – EddyTheDove