master

laravel/framework

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

Notification.php

TLDR

This file contains the Notification class, which is responsible for handling notifications. It includes properties for the notification ID and locale, as well as methods for broadcasting the notification and setting the locale.

Classes

Notification

The Notification class handles notifications. It includes the following properties:

  • $id: The unique identifier for the notification.
  • $locale: The locale to be used when sending the notification.

And the following methods:

  • broadcastOn(): Returns an empty array, indicating that this notification should not be broadcasted.
  • locale($locale): Sets the locale to send this notification in.
<?php

namespace Illuminate\Notifications;

use Illuminate\Queue\SerializesModels;

class Notification
{
    use SerializesModels;

    /**
     * The unique identifier for the notification.
     *
     * @var string
     */
    public $id;

    /**
     * The locale to be used when sending the notification.
     *
     * @var string|null
     */
    public $locale;

    /**
     * Get the channels the event should broadcast on.
     *
     * @return array
     */
    public function broadcastOn()
    {
        return [];
    }

    /**
     * Set the locale to send this notification in.
     *
     * @param  string  $locale
     * @return $this
     */
    public function locale($locale)
    {
        $this->locale = $locale;

        return $this;
    }
}