master

laravel/framework

Last updated at: 29/12/2023 09:24

BroadcastMessage.php

TLDR

The BroadcastMessage class in the Illuminate\Notifications\Messages namespace is used to create broadcast messages for notifications. It includes methods to set and retrieve the message data.

Classes

BroadcastMessage

The BroadcastMessage class is used to create broadcast messages for notifications. It includes the following methods:

  • __construct(array $data): Initializes a new instance of the class with the given data.
  • data($data): Sets the message data to the provided value.
<?php

namespace Illuminate\Notifications\Messages;

use Illuminate\Bus\Queueable;

class BroadcastMessage
{
    use Queueable;

    /**
     * The data for the notification.
     *
     * @var array
     */
    public $data;

    /**
     * Create a new message instance.
     *
     * @param  array  $data
     * @return void
     */
    public function __construct(array $data)
    {
        $this->data = $data;
    }

    /**
     * Set the message data.
     *
     * @param  array  $data
     * @return $this
     */
    public function data($data)
    {
        $this->data = $data;

        return $this;
    }
}