Skip to content

[5.6] Only set ID on NotificationFake if there is no ID set#23470

Merged
taylorotwell merged 3 commits into
laravel:5.6from
hotmeteor:5.6
Mar 9, 2018
Merged

[5.6] Only set ID on NotificationFake if there is no ID set#23470
taylorotwell merged 3 commits into
laravel:5.6from
hotmeteor:5.6

Conversation

@hotmeteor

@hotmeteor hotmeteor commented Mar 9, 2018

Copy link
Copy Markdown
Contributor

This PR makes the NotificationFake@sendNow method behave the same way as the sending functionality in the NotificationSender, in which the sender checks if the notification ID has already been set before setting it.

@hotmeteor hotmeteor changed the title Only set ID on NotificationFake if there is no ID set [5.6] Only set ID on NotificationFake if there is no ID set Mar 9, 2018
@ninjaparade

Copy link
Copy Markdown
Contributor

This might be the greatest idea since your ->doesntExist() on the Query builder that the frontend guy claimed as his own. 💥 💣

@taylorotwell taylorotwell merged commit 8a06746 into laravel:5.6 Mar 9, 2018

foreach ($notifiables as $notifiable) {
$notification->id = Uuid::uuid4()->toString();
if (! $notification->id) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might sound a bit nitpicky, but wouldn't checking for null be preferable here to allow '0' to be used as an ID?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well a UUID would never be 0, so not sure that makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants