Notification   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 2
Metric Value
wmc 2
eloc 25
c 2
b 0
f 2
dl 0
loc 36
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A template() 0 3 1
A user() 0 3 1
1
<?php
2
3
namespace Usamamuneerchaudhary\Notifier\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Database\Eloquent\Relations\BelongsTo;
7
8
class Notification extends Model
9
{
10
    protected $table = 'notifier_notifications';
11
    protected $fillable = [
12
        'notification_template_id',
13
        'user_id',
14
        'channel',
15
        'subject',
16
        'content',
17
        'data',
18
        'scheduled_at',
19
        'sent_at',
20
        'status',
21
        'error',
22
        'opened_at',
23
        'clicked_at',
24
        'opens_count',
25
        'clicks_count',
26
    ];
27
28
    protected $casts = [
29
        'data' => 'array',
30
        'scheduled_at' => 'datetime',
31
        'sent_at' => 'datetime',
32
        'opened_at' => 'datetime',
33
        'clicked_at' => 'datetime',
34
    ];
35
36
    public function template(): BelongsTo
37
    {
38
        return $this->belongsTo(NotificationTemplate::class, 'notification_template_id');
39
    }
40
41
    public function user(): BelongsTo
42
    {
43
        return $this->belongsTo(config('auth.providers.users.model'));
44
    }
45
}
46