Ich benutze L5.3.Laravel Queueable Benachrichtigung nach dem Löschen Das Modell funktioniert nicht
Ich habe eine Menge Queueable Laravel Benachrichtigungen, sie arbeiten mit Redis in Ordnung. Außer Benachrichtigungen im Zusammenhang mit dem Löschen einiger Eloquent-Modelle.
Hier Mitteilung Quelle Beispiel ist:
<?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])
];
}
}
Und es ist, wie ich es an: $user->notify(new Deleted($id));
Wenn ich implements ShouldQueue
entfernen, Benachrichtigung funktioniert. Aber ich brauche Warteschlangen wegen der Verwendung mehrerer externer Dienste (wie Telegram, Facebook, Ein Signal usw.) und einige Benachrichtigungen könnten an viele Benutzer gesendet werden.
Es gibt auch keine Fehler in storage\logs\laravel.log
und storage\logs\worker.log
Dateien. Keine Artikel in failed_jobs
Tabelle.
Und ja, ich soft deleting
Modelle verwenden.