-
Notifications
You must be signed in to change notification settings - Fork 581
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
NotificationWatcher formatNotifiable TypeError #1375
Comments
I'm not sure what the proper solution here is but would appreciate a PR if you can figure something out, thanks! |
Thank you for reporting this issue! As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub. If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team. Thank you! |
I made the instanceof judgment, I think we should add some other type judgment, View the Notification facade * @method static void send(\Illuminate\Support\Collection|array|mixed $notifiables, mixed $notification) Supported type, I'm not sure what type formatNotifiable should return in array, but is it now a string |
Hi there, right now we don't document the usage of notifications like this. Therefor, I don't think we can consider this as supported, sorry. Please use regular class based notifications, thanks. |
I think it's rude to closed issues that way, and I don't know why that is, According to Notification ::send(\Illuminate\Support\Collection|array|mixed $notifiables, mixed $notification) is a $notifiables that supports incoming array types. Is it not supported because it is an error for me to call send incoming array? |
Telescope Version
4.16.0
Laravel Version
10.18.0
PHP Version
8.1.4
Database Driver & Version
8.0.27
Description
When the incoming $notifiable is an array, the error is: NotificationWatcher formatNotifiable TypeError
telescope/src/Watchers/NotificationWatcher.php
Lines 67 to 80 in b5def3d
Should an is_array($notifiable) be added before return get_class($notifiable) in the formatNotifiable method?
Steps To Reproduce
step1: Generating Notifications
php artisan make:notification InvoicePaid
step2: Using The Notification Facade
Now use the facade to send messages, and when the incoming parameter $notifiables is an array, the class
NotificationWatcher
on methodformatNotifiable
of the telescope will report an error: "NotificationWatcher formatNotifiable TypeError" when checking the type because $notifiables is not a class but an array, using get_class($notifiable)The text was updated successfully, but these errors were encountered: