/** * Send notifications. * * @param bool $clear Clear notifications after sending them. * * @return void */ public function send($clear = true) { $notificationIds = array_keys($this->notifications); $collection = Notification::findMultipleByIds($notificationIds); if ($collection) { foreach ($collection as $notification) { $message = $this->notifications[$collection->id]; $notification->current()->send($message['data'], $message['language']); } } if ($clear) { $this->clear(); } }