NotificationPreference   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A event() 0 3 1
A user() 0 3 1
1
<?php
2
namespace Usamamuneerchaudhary\Notifier\Models;
3
4
use Illuminate\Database\Eloquent\Model;
5
use Illuminate\Database\Eloquent\Relations\BelongsTo;
6
7
class NotificationPreference extends Model
8
{
9
    protected $table = 'notifier_preferences';
10
    protected $fillable = [
11
        'user_id',
12
        'notification_event_id',
13
        'channels',
14
        'settings',
15
    ];
16
17
    protected $casts = [
18
        'channels' => 'array',
19
        'settings' => 'array',
20
    ];
21
22
    public function user(): BelongsTo
23
    {
24
        return $this->belongsTo(config('auth.providers.users.model'));
25
    }
26
27
    public function event(): BelongsTo
28
    {
29
        return $this->belongsTo(NotificationEvent::class, 'notification_event_id');
30
    }
31
}
32