Total Complexity | 4 |
Total Lines | 32 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
15 | class TrackedNotification extends Model |
||
16 | { |
||
17 | use HasFactory; |
||
18 | |||
19 | protected $guarded = []; |
||
20 | |||
21 | protected $casts = [ |
||
22 | 'meta' => SimpleJsonField::class, |
||
23 | ]; |
||
24 | |||
25 | 9 | public function getTable(): string |
|
26 | { |
||
27 | 9 | return config('notification-tracker.tables.notifications'); |
|
28 | } |
||
29 | |||
30 | 9 | protected static function boot(): void |
|
31 | { |
||
32 | 9 | parent::boot(); |
|
33 | |||
34 | 9 | static::deleting(function ($model) { |
|
35 | 1 | $model->channels->each(fn ($channel) => $channel->delete()); |
|
36 | 9 | }); |
|
37 | } |
||
38 | |||
39 | 5 | protected static function newFactory(): TrackedNotificationFactory |
|
40 | { |
||
41 | 5 | return TrackedNotificationFactory::new(); |
|
42 | } |
||
43 | |||
44 | 6 | public function channels(): HasMany |
|
47 | } |
||
48 | } |
||
49 |