dev-think-one /
laravel-notification-tracker
| 1 | <?php |
||
| 2 | |||
| 3 | namespace NotificationTracker\Notification; |
||
| 4 | |||
| 5 | use NotificationTracker\NotificationTracker; |
||
| 6 | |||
| 7 | trait HasTracker |
||
| 8 | { |
||
| 9 | protected ?Tracker $_tracker = null; |
||
| 10 | |||
| 11 | 5 | public function tracker(): Tracker |
|
| 12 | { |
||
| 13 | 5 | if ($this->_tracker) { |
|
| 14 | 3 | return $this->_tracker; |
|
| 15 | } |
||
| 16 | |||
| 17 | 5 | return $this->_tracker = new Tracker($this); |
|
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 18 | } |
||
| 19 | |||
| 20 | 5 | public function getClassAlias(): string |
|
| 21 | { |
||
| 22 | 5 | return NotificationTracker::getMapAlias(static::class); |
|
| 23 | } |
||
| 24 | |||
| 25 | 3 | public function trackerMeta(string|\Closure $key = null, mixed $value = null): static |
|
| 26 | { |
||
| 27 | 3 | $this->tracker()->trackerMeta($key, $value); |
|
| 28 | |||
| 29 | 3 | return $this; |
|
| 30 | } |
||
| 31 | |||
| 32 | 3 | public function notificationMeta(string|\Closure $key = null, mixed $value = null): static |
|
| 33 | { |
||
| 34 | 3 | $this->tracker()->notificationMeta($key, $value); |
|
| 35 | |||
| 36 | 3 | return $this; |
|
| 37 | } |
||
| 38 | } |
||
| 39 |