Notification::template()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 1
c 1
b 0
f 1
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
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