NotificationTemplate::event()   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
use Illuminate\Database\Eloquent\Relations\HasMany;
8
9
class NotificationTemplate extends Model
10
{
11
    protected $table = 'notifier_templates';
12
    protected $fillable = [
13
        'name',
14
        'event_key',
15
        'subject',
16
        'content',
17
        'variables',
18
        'is_active',
19
    ];
20
21
    protected $casts = [
22
        'variables' => 'array',
23
        'is_active' => 'boolean',
24
    ];
25
26
    public function event(): BelongsTo
27
    {
28
        return $this->belongsTo(NotificationEvent::class, 'event_key', 'key');
29
    }
30
31
    public function notifications(): HasMany
32
    {
33
        return $this->hasMany(Notification::class);
34
    }
35
}
36