SendExpiringPartnershipsAlerts   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 9
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 7 2
1
<?php
2
3
namespace App\Listeners;
4
5
use App\Mail\ExpiringPartnershipAlert;
6
use Carbon\Carbon;
7
use Illuminate\Support\Facades\Mail;
8
9
class SendExpiringPartnershipsAlerts
10
{
11
    public function handle($event)
12
    {
13
        foreach ($event->partners as $partner) {
14
            Mail::to(config('settings.secretary_email'))->queue(new ExpiringPartnershipAlert($partner));
15
16
            $partner->last_alert_sent_at = Carbon::now()->format('Y-m-d');
17
            $partner->save();
18
        }
19
    }
20
}
21