Notifiable.php 515 B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace addons\shopro\library\notify\traits;
  3. /**
  4. * 消息通知 trait
  5. */
  6. trait Notifiable
  7. {
  8. public function notify ($notification) {
  9. return \addons\shopro\library\notify\Notify::send([$this], $notification);
  10. }
  11. /**
  12. * 获取 notifiable 身份类型 admin, user
  13. *
  14. * @return void
  15. */
  16. public function getNotifiableType()
  17. {
  18. $notifiable_type = str_replace('\\', '', strtolower(strrchr(static::class, '\\')));
  19. return $notifiable_type;
  20. }
  21. }