Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[12.x] use promoted properties for Notification events #53853

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,40 +14,19 @@ class BroadcastNotificationCreated implements ShouldBroadcast
{
use Queueable, SerializesModels;

/**
* The notifiable entity who received the notification.
*
* @var mixed
*/
public $notifiable;

/**
* The notification instance.
*
* @var \Illuminate\Notifications\Notification
*/
public $notification;

/**
* The notification data.
*
* @var array
*/
public $data = [];

/**
* Create a new event instance.
*
* @param mixed $notifiable
* @param \Illuminate\Notifications\Notification $notification
* @param array $data
* @param mixed $notifiable The notifiable entity who received the notification.
* @param \Illuminate\Notifications\Notification $notification The notification instance.
* @param array $data The notification data.
* @return void
*/
public function __construct($notifiable, $notification, $data)
{
$this->data = $data;
$this->notifiable = $notifiable;
$this->notification = $notification;
public function __construct(
public $notifiable,
public $notification,
public $data = [],
) {
}

/**
Expand Down
48 changes: 10 additions & 38 deletions src/Illuminate/Notifications/Events/NotificationFailed.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,48 +9,20 @@ class NotificationFailed
{
use Queueable, SerializesModels;

/**
* The notifiable entity who received the notification.
*
* @var mixed
*/
public $notifiable;

/**
* The notification instance.
*
* @var \Illuminate\Notifications\Notification
*/
public $notification;

/**
* The channel name.
*
* @var string
*/
public $channel;

/**
* The data needed to process this failure.
*
* @var array
*/
public $data = [];

/**
* Create a new event instance.
*
* @param mixed $notifiable
* @param \Illuminate\Notifications\Notification $notification
* @param string $channel
* @param array $data
* @param mixed $notifiable The notifiable entity who received the notification.
* @param \Illuminate\Notifications\Notification $notification The notification instance.
* @param string $channel The channel name.
* @param array $data The data needed to process this failure.
* @return void
*/
public function __construct($notifiable, $notification, $channel, $data = [])
{
$this->data = $data;
$this->channel = $channel;
$this->notifiable = $notifiable;
$this->notification = $notification;
public function __construct(
public $notifiable,
public $notification,
public $channel,
public $data = [],
) {
}
}
37 changes: 8 additions & 29 deletions src/Illuminate/Notifications/Events/NotificationSending.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,18 @@ class NotificationSending
{
use Queueable, SerializesModels;

/**
* The notifiable entity who received the notification.
*
* @var mixed
*/
public $notifiable;

/**
* The notification instance.
*
* @var \Illuminate\Notifications\Notification
*/
public $notification;

/**
* The channel name.
*
* @var string
*/
public $channel;

/**
* Create a new event instance.
*
* @param mixed $notifiable
* @param \Illuminate\Notifications\Notification $notification
* @param string $channel
* @param mixed $notifiable The notifiable entity who received the notification.
* @param \Illuminate\Notifications\Notification $notification The notification instance.
* @param string $channel The channel name.
* @return void
*/
public function __construct($notifiable, $notification, $channel)
{
$this->channel = $channel;
$this->notifiable = $notifiable;
$this->notification = $notification;
public function __construct(
public $notifiable,
public $notification,
public $channel,
) {
}
}
48 changes: 10 additions & 38 deletions src/Illuminate/Notifications/Events/NotificationSent.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,48 +9,20 @@ class NotificationSent
{
use Queueable, SerializesModels;

/**
* The notifiable entity who received the notification.
*
* @var mixed
*/
public $notifiable;

/**
* The notification instance.
*
* @var \Illuminate\Notifications\Notification
*/
public $notification;

/**
* The channel name.
*
* @var string
*/
public $channel;

/**
* The channel's response.
*
* @var mixed
*/
public $response;

/**
* Create a new event instance.
*
* @param mixed $notifiable
* @param \Illuminate\Notifications\Notification $notification
* @param string $channel
* @param mixed $response
* @param mixed $notifiable The notifiable entity who received the notification.
* @param \Illuminate\Notifications\Notification $notification The notification instance.
* @param string $channel The channel name.
* @param mixed $response The channel's response.
* @return void
*/
public function __construct($notifiable, $notification, $channel, $response = null)
{
$this->channel = $channel;
$this->response = $response;
$this->notifiable = $notifiable;
$this->notification = $notification;
public function __construct(
public $notifiable,
public $notification,
public $channel,
public $response = null,
) {
}
}
Loading