Notification

class Notification implements Arrayable (View source)

Traits

SerializesModels

Properties

Collection $notifiables The entities that should receive the notification.
$via The channels that the notification should be sent through.
string $application The name of the application sending the notification.
string $logoUrl The URL to the application's logo.
string $level The "level" of the notification (info, success, error).
string $subject The subject of the notification.
array $introLines The "intro" lines of the notification.
array $outroLines The "outro" lines of the notification.
string $actionText The text / label for the action.
string $actionUrl The action URL.
array $options The notification's options.

Methods

array __sleep()

Prepare the instance for serialization.

from SerializesModels
void __wakeup()

Restore the model after serialization.

from SerializesModels
mixed getSerializedPropertyValue(mixed $value)

Get the property value prepared for serialization.

from SerializesModels
mixed getRestoredPropertyValue(mixed $value)

Get the restored property value after deserialization.

from SerializesModels
Collection restoreCollection(ModelIdentifier $value)

Restore a queueable collection instance.

from SerializesModels
mixed getPropertyValue(ReflectionProperty $property)

Get the property value for the given property.

from SerializesModels
void __construct(Collection|array|mixed $notifiables)

Create a new notification instance.

$this application(string $application, string $logoUrl = null)

Specify the name of the application sending the notification.

$this success()

Indicate that the notification gives information about a successful operation.

$this error()

Indicate that the notification gives information about an error.

$this level(string $level)

Set the "level" of the notification (success, error, etc.).

$this subject(string $subject)

Set the subject of the notification.

$this line(Action|string $line)

Add a line of text to the notification.

$this with(Action|string $line)

Add a line of text to the notification.

$this options(array $options)

Set the notification's options.

$this action(string $text, string $url)

Configure the "call to action" button.

$this via(array|string $channels)

Set the channels that should be used to deliver the notification.

void send()

Send the notification.

static array[static] notificationsFromInstance(mixed $notifiable, mixed $instance, array|null $channels = null)

Build new channel notifications from the given object.

static Notification buildNotification(mixed $notifiable, mixed $instance, string $channel)

Build a new channel notification.

static string messageMethod(mixed $instance, string $channel)

Get the proper message method for the given instance and channel.

static string optionsMethod(mixed $instance, string $channel)

Get the proper data method for the given instance and channel.

array toArray()

Get the instance as an array.

Details

array __sleep()

Prepare the instance for serialization.

Return Value

array

void __wakeup()

Restore the model after serialization.

Return Value

void

protected mixed getSerializedPropertyValue(mixed $value)

Get the property value prepared for serialization.

Parameters

mixed $value

Return Value

mixed

protected mixed getRestoredPropertyValue(mixed $value)

Get the restored property value after deserialization.

Parameters

mixed $value

Return Value

mixed

protected Collection restoreCollection(ModelIdentifier $value)

Restore a queueable collection instance.

Parameters

ModelIdentifier $value

Return Value

Collection

protected mixed getPropertyValue(ReflectionProperty $property)

Get the property value for the given property.

Parameters

ReflectionProperty $property

Return Value

mixed

void __construct(Collection|array|mixed $notifiables)

Create a new notification instance.

Parameters

Collection|array|mixed $notifiables

Return Value

void

$this application(string $application, string $logoUrl = null)

Specify the name of the application sending the notification.

Parameters

string $application
string $logoUrl

Return Value

$this

$this success()

Indicate that the notification gives information about a successful operation.

Return Value

$this

$this error()

Indicate that the notification gives information about an error.

Return Value

$this

$this level(string $level)

Set the "level" of the notification (success, error, etc.).

Parameters

string $level

Return Value

$this

$this subject(string $subject)

Set the subject of the notification.

Parameters

string $subject

Return Value

$this

$this line(Action|string $line)

Add a line of text to the notification.

Parameters

Action|string $line

Return Value

$this

$this with(Action|string $line)

Add a line of text to the notification.

Parameters

Action|string $line

Return Value

$this

$this options(array $options)

Set the notification's options.

Parameters

array $options

Return Value

$this

$this action(string $text, string $url)

Configure the "call to action" button.

Parameters

string $text
string $url

Return Value

$this

$this via(array|string $channels)

Set the channels that should be used to deliver the notification.

Parameters

array|string $channels

Return Value

$this

void send()

Send the notification.

Return Value

void

static array[static] notificationsFromInstance(mixed $notifiable, mixed $instance, array|null $channels = null)

Build new channel notifications from the given object.

Parameters

mixed $notifiable
mixed $instance
array|null $channels

Return Value

array[static]

static protected Notification buildNotification(mixed $notifiable, mixed $instance, string $channel)

Build a new channel notification.

Parameters

mixed $notifiable
mixed $instance
string $channel

Return Value

Notification

static protected string messageMethod(mixed $instance, string $channel)

Get the proper message method for the given instance and channel.

Parameters

mixed $instance
string $channel

Return Value

string

static protected string optionsMethod(mixed $instance, string $channel)

Get the proper data method for the given instance and channel.

Parameters

mixed $instance
string $channel

Return Value

string

array toArray()

Get the instance as an array.

Return Value

array

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.6/Illuminate/Notifications/Channels/Notification.html