verbesserung von benachrichtungen und warnungen an nutzer abgeschlossen. layout editor nun auf gutem stand.

This commit is contained in:
Codex Agent
2025-11-02 11:11:13 +01:00
parent 8e6c66f0db
commit 792b5dfe8b
32 changed files with 1292 additions and 149 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Jobs\Packages;
use App\Jobs\Concerns\LogsTenantNotifications;
use App\Models\Tenant;
use App\Notifications\Packages\TenantCreditsLowNotification;
use Illuminate\Bus\Queueable;
@@ -16,6 +17,7 @@ class SendTenantCreditsLowNotification implements ShouldQueue
{
use Dispatchable;
use InteractsWithQueue;
use LogsTenantNotifications;
use Queueable;
use SerializesModels;
@@ -39,6 +41,16 @@ class SendTenantCreditsLowNotification implements ShouldQueue
$preferences = app(\App\Services\Packages\TenantNotificationPreferences::class);
if (! $preferences->shouldNotify($tenant, 'credits_low')) {
$this->logNotification($tenant, [
'type' => 'credits_low',
'status' => 'skipped',
'context' => [
'balance' => $this->balance,
'threshold' => $this->threshold,
'reason' => 'opt_out',
],
]);
return;
}
@@ -53,15 +65,36 @@ class SendTenantCreditsLowNotification implements ShouldQueue
'tenant_id' => $tenant->id,
]);
$this->logNotification($tenant, [
'type' => 'credits_low',
'status' => 'skipped',
'context' => [
'balance' => $this->balance,
'threshold' => $this->threshold,
'reason' => 'no_recipient',
],
]);
return;
}
foreach ($emails as $email) {
Notification::route('mail', $email)->notify(new TenantCreditsLowNotification(
$tenant,
$this->balance,
$this->threshold,
));
}
$context = [
'balance' => $this->balance,
'threshold' => $this->threshold,
];
$this->dispatchToRecipients(
$tenant,
$emails,
'credits_low',
function (string $email) use ($tenant) {
Notification::route('mail', $email)->notify(new TenantCreditsLowNotification(
$tenant,
$this->balance,
$this->threshold,
));
},
$context
);
}
}