verbesserung von benachrichtungen und warnungen an nutzer abgeschlossen. layout editor nun auf gutem stand.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Jobs\Packages;
|
||||
|
||||
use App\Jobs\Concerns\LogsTenantNotifications;
|
||||
use App\Models\EventPackage;
|
||||
use App\Notifications\Packages\EventPackageGuestLimitNotification;
|
||||
use Illuminate\Bus\Queueable;
|
||||
@@ -16,6 +17,7 @@ class SendEventPackageGuestLimitNotification implements ShouldQueue
|
||||
{
|
||||
use Dispatchable;
|
||||
use InteractsWithQueue;
|
||||
use LogsTenantNotifications;
|
||||
use Queueable;
|
||||
use SerializesModels;
|
||||
|
||||
@@ -43,6 +45,12 @@ class SendEventPackageGuestLimitNotification implements ShouldQueue
|
||||
|
||||
$preferences = app(\App\Services\Packages\TenantNotificationPreferences::class);
|
||||
if (! $preferences->shouldNotify($tenant, 'guest_limits')) {
|
||||
$this->logNotification($tenant, [
|
||||
'type' => 'guest_limit',
|
||||
'status' => 'skipped',
|
||||
'context' => $this->context($eventPackage),
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -57,14 +65,37 @@ class SendEventPackageGuestLimitNotification implements ShouldQueue
|
||||
'event_package_id' => $eventPackage->id,
|
||||
]);
|
||||
|
||||
$this->logNotification($tenant, [
|
||||
'type' => 'guest_limit',
|
||||
'status' => 'skipped',
|
||||
'context' => array_merge($this->context($eventPackage), ['reason' => 'no_recipient']),
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($emails as $email) {
|
||||
Notification::route('mail', $email)->notify(new EventPackageGuestLimitNotification(
|
||||
$eventPackage,
|
||||
$this->limit,
|
||||
));
|
||||
}
|
||||
$context = $this->context($eventPackage);
|
||||
|
||||
$this->dispatchToRecipients(
|
||||
$tenant,
|
||||
$emails,
|
||||
'guest_limit',
|
||||
function (string $email) use ($eventPackage) {
|
||||
Notification::route('mail', $email)->notify(new EventPackageGuestLimitNotification(
|
||||
$eventPackage,
|
||||
$this->limit,
|
||||
));
|
||||
},
|
||||
$context
|
||||
);
|
||||
}
|
||||
|
||||
private function context(EventPackage $eventPackage): array
|
||||
{
|
||||
return [
|
||||
'event_package_id' => $eventPackage->id,
|
||||
'event_id' => $eventPackage->event_id,
|
||||
'limit' => $this->limit,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user