Test Failed
Push — main ( d83f6c...37d714 )
by Davide
28:29 queued 10:26
created

NotificationService::sendEmailNewTestimonial()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 6
rs 10
1
<?php
2
3
namespace App\Services;
4
5
use App\Models\User;
6
use App\Notifications\ContactMeMailNotification;
7
use App\Notifications\GetATreatmentMailNotification;
8
use App\Notifications\NewTestimonialMailNotification;
9
10
class NotificationService
11
{
12
13
    /**
14
     * Send an email when the contact form is submitted
15
     *
16
     * @param array $data
17
     * @param int $userId
18
     *
19
     * @return bool
20
     */
21
    public function sendEmailContactMe(array $data, int $userId): bool
22
    {
23
        $user = User::find($userId);
24
        $user->notify(new ContactMeMailNotification($data));
25
26
        return true;
27
    }
28
29
    /**
30
     * Send an email when the get a treatment form is submitted
31
     *
32
     * @param array $data
33
     * @param int $userId
34
     *
35
     * @return bool
36
     */
37
    public function sendEmailGetATreatment(array $data, int $userId): bool
38
    {
39
        $user = User::find($userId);
40
        $user->notify(new GetATreatmentMailNotification($data));
41
42
        return true;
43
    }
44
45
    /**
46
     * Send an email when the new testimonial form is submitted
47
     *
48
     * @param  array  $data
49
     * @param  int  $userId
50
     *
51
     * @return bool
52
     */
53
    public function sendEmailNewTestimonial(array $data, int $userId): bool
54
    {
55
        $user = User::find($userId);
56
        $user->notify(new NewTestimonialMailNotification($data));
57
58
        return true;
59
    }
60
61
}
62