私はL5.3を使用しています。Laravel削除後のキュー可能通知モデルが動作しない
私はQueueable Laravel Notificationsをたくさん持っていますが、彼らはRedisでうまく動作しています。 Eloquent Modelの削除に関する通知を除きます。ここで
は、通知ソースの例です:
<?php
namespace App\Notifications\Games;
use App\Helpers\NotificationHelper;
use App\Game;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Support\Facades\Log;
class Deleted extends Notification implements ShouldQueue
{
use Queueable;
public $game;
private $game_id;
public function __construct($game_id)
{
$this->game_id = $game_id;
$this->game = Game::withTrashed()->with('situation')->find($game_id);
// Log::info($this->game) here shows everything is ok
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return ['database'];
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toDatabase($notifiable)
{
return [
'game_id' => $this->game->id,
'html' => '' . view('notifications.games.deleted', ['id' => $this->id, 'game' => $this->game, 'notifiable' => $notifiable])
];
}
}
そして、私はそれを送信する方法があります: $user->notify(new Deleted($id));
私は、通知の作品をimplements ShouldQueue
を削除した場合。しかし、私はいくつかの外部サービス(テレグラム、Facebook、ワン信号など)を使用しているためキューが必要であり、いくつかの通知を多くのユーザーに送ることができます。
storage\logs\laravel.log
とstorage\logs\worker.log
ファイルにもエラーはありません。 failed_jobs
の項目はありません。
はい、私はモデルのsoft deleting
を使用しています。