12-05-2026 Frontend dev
This commit is contained in:
parent
405df0a122
commit
5b8bdf4182
779 changed files with 480564 additions and 6241 deletions
24
app/Services/Newsletter/NewsletterSyncService.php
Normal file
24
app/Services/Newsletter/NewsletterSyncService.php
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace App\Services\Newsletter;
|
||||
|
||||
use App\Contracts\NewsletterSyncClient;
|
||||
use App\Models\NewsletterSubscription;
|
||||
|
||||
class NewsletterSyncService
|
||||
{
|
||||
public function __construct(
|
||||
private readonly NewsletterSyncClient $client
|
||||
) {}
|
||||
|
||||
public function syncSubscription(NewsletterSubscription $subscription): void
|
||||
{
|
||||
if ($subscription->is_confirmed && $subscription->unsubscribed_at === null) {
|
||||
$this->client->subscribe($subscription);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->client->unsubscribe($subscription);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue