Notification.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace Illuminate\Support\Facades;
  3. use Illuminate\Notifications\AnonymousNotifiable;
  4. use Illuminate\Notifications\ChannelManager;
  5. use Illuminate\Support\Testing\Fakes\NotificationFake;
  6. /**
  7. * @method static \Illuminate\Notifications\ChannelManager locale(string|null $locale)
  8. * @method static \Illuminate\Support\Collection sent(mixed $notifiable, string $notification, callable $callback = null)
  9. * @method static bool hasSent(mixed $notifiable, string $notification)
  10. * @method static mixed channel(string|null $name = null)
  11. * @method static void assertNotSentTo(mixed $notifiable, string|\Closure $notification, callable $callback = null)
  12. * @method static void assertNothingSent()
  13. * @method static void assertSentOnDemand(string|\Closure $notification, callable $callback = null)
  14. * @method static void assertSentTo(mixed $notifiable, string|\Closure $notification, callable $callback = null)
  15. * @method static void assertSentOnDemandTimes(string $notification, int $times = 1)
  16. * @method static void assertSentToTimes(mixed $notifiable, string $notification, int $times = 1)
  17. * @method static void assertTimesSent(int $expectedCount, string $notification)
  18. * @method static void send(\Illuminate\Support\Collection|array|mixed $notifiables, $notification)
  19. * @method static void sendNow(\Illuminate\Support\Collection|array|mixed $notifiables, $notification)
  20. *
  21. * @see \Illuminate\Notifications\ChannelManager
  22. */
  23. class Notification extends Facade
  24. {
  25. /**
  26. * Replace the bound instance with a fake.
  27. *
  28. * @return \Illuminate\Support\Testing\Fakes\NotificationFake
  29. */
  30. public static function fake()
  31. {
  32. static::swap($fake = new NotificationFake);
  33. return $fake;
  34. }
  35. /**
  36. * Begin sending a notification to an anonymous notifiable.
  37. *
  38. * @param string $channel
  39. * @param mixed $route
  40. * @return \Illuminate\Notifications\AnonymousNotifiable
  41. */
  42. public static function route($channel, $route)
  43. {
  44. return (new AnonymousNotifiable)->route($channel, $route);
  45. }
  46. /**
  47. * Get the registered name of the component.
  48. *
  49. * @return string
  50. */
  51. protected static function getFacadeAccessor()
  52. {
  53. return ChannelManager::class;
  54. }
  55. }