| Total Complexity | 6 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Coverage | 89.47% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | trait InPeriodicNotice |
||
| 14 | { |
||
| 15 | 1 | public function notificationEntityTitle(): string |
|
| 16 | { |
||
| 17 | 1 | return $this->title ?? ''; |
|
| 18 | } |
||
| 19 | |||
| 20 | 1 | public function notificationEntityWebUrl(): string |
|
| 21 | { |
||
| 22 | 1 | return url($this->slug ?? ''); |
|
| 23 | } |
||
| 24 | |||
| 25 | 1 | public function notificationEntityDescription(): string |
|
| 26 | { |
||
| 27 | 1 | return $this->description ?? ''; |
|
| 28 | } |
||
| 29 | |||
| 30 | 2 | public function periodicSentEntries(): MorphMany |
|
| 31 | { |
||
| 32 | 2 | return $this->morphMany(PeriodicSentEntry::class, 'sendable'); |
|
|
|
|||
| 33 | } |
||
| 34 | |||
| 35 | 2 | public function scopeDoesntSentInPeriodicNotice(Builder $query, Model $receiver, string $group) |
|
| 36 | { |
||
| 37 | 2 | $query->whereDoesntHave( |
|
| 38 | 2 | 'periodicSentEntries', |
|
| 39 | 2 | function (Builder $query) use ($receiver, $group) { |
|
| 40 | 2 | $query->group($group) |
|
| 41 | 2 | ->where('receiver_type', '=', $receiver->getMorphClass()) |
|
| 42 | 2 | ->where('receiver_id', '=', $receiver->getKey()); |
|
| 43 | 2 | } |
|
| 44 | 2 | ); |
|
| 45 | } |
||
| 46 | |||
| 47 | public function scopeReleasedAfter(Builder $query, \DateTimeInterface|string $dateTime, string $group) |
||
| 50 | } |
||
| 51 | } |
||
| 52 |