1
0
mirror of https://github.com/flarum/core.git synced 2025-10-19 02:36:08 +02:00

Add NotificationWillBeSent event

This commit is contained in:
Toby Zerner
2015-06-01 08:52:04 +09:30
parent 1153e41b7a
commit 351775ef02
2 changed files with 19 additions and 0 deletions

View File

@@ -2,6 +2,7 @@
use Flarum\Core\Repositories\NotificationRepositoryInterface;
use Flarum\Core\Models\Notification;
use Flarum\Core\Events\NotificationWillBeSent;
use Carbon\Carbon;
use Closure;
@@ -66,6 +67,8 @@ class NotificationSyncer
if (count($newRecipients)) {
$now = Carbon::now('utc')->toDateTimeString();
event(new NotificationWillBeSent($notification, $newRecipients));
Notification::insert(
array_map(function ($user) use ($attributes, $notification, $now) {
return $attributes + ['user_id' => $user->id, 'time' => $now];