title: Batch user notification in Laravel
body: <p>I have an application created using Laravel. There are times that I need to send notification (via Database) to my users.</p>
  <p>The problem: Whenever I said notification to all my users (~15k) my app stops working.  Is there any way I can batch this process?</p>
  <p>I am using a livewire component to send the notification. When I send a notification to specific users, there's no problem with it. However, when I send the notification to all users, my app freezes.</p>
  <pre><code>// livewire component
  Notification::send($users, new \App\Notifications\SendNotification($this-&gt;title, $this-&gt;message));
  </code></pre>
  <p>This is my SendNotification.php</p>
  <pre><code>&lt;?php
  
  namespace App\Notifications;
  
  use Illuminate\Bus\Queueable;
  use Illuminate\Contracts\Queue\ShouldQueue;
  use Illuminate\Notifications\Messages\MailMessage;
  use Illuminate\Notifications\Notification;
  
  class SendNotification extends Notification implements ShouldQueue
  {
      use Queueable;
  
      protected $title;
      protected $message;
  
      /**
       * Create a new notification instance.
       *
       * @param $title
       * @param $message
       */
      public function __construct($title, $message)
      {
          $this-&gt;title = $title;
          $this-&gt;message = $message;
      }
  
      /**
       * Get the notification's delivery channels.
       *
       * @param  mixed  $notifiable
       * @return array
       */
      public function via($notifiable)
      {
          return ['database'];
      }
  
      public function toDatabase($notifiable)
      {
          return [
              'title' =&gt; $this-&gt;title,
              'message' =&gt; $this-&gt;message,
          ];
      }
  }
  </code></pre>