MessageNotify.php 818 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace App\Modules\Message;
  3. /**
  4. * 消息通知
  5. *
  6. * @method static \App\Modules\Message\MailNotify mail(array $data)
  7. */
  8. class MessageNotify
  9. {
  10. private static $model_names = [
  11. 'mail' => 'MailNotify',
  12. ];
  13. /**
  14. * @param string $name
  15. * @param array $config
  16. *
  17. */
  18. public static function make($name, array $config)
  19. {
  20. $namespace = self::$model_names[$name];
  21. $application = "\\App\\Modules\\Message\\{$namespace}";
  22. return new $application($config);
  23. }
  24. /**
  25. * Dynamically pass methods to the application.
  26. *
  27. * @param string $name
  28. * @param array $arguments
  29. *
  30. * @return mixed
  31. */
  32. public static function __callStatic($name, $arguments)
  33. {
  34. return self::make($name, ...$arguments);
  35. }
  36. }