-
-
Notifications
You must be signed in to change notification settings - Fork 194
[Bug]: Notifications Not Showing #48
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
Comments
Hi. $client = new Client();
$notification = new Notification($client);
$notification->title('Hello from NativeApp')
->message('This is a detailed message coming from your native app.')
->show(); The reason is that the Notification class is not in the place written in the documentation, but it is located in this place: In addition, the title function in the Notification class is not static. |
Thanks @khalmurad This solution you pointed worked out fine... |
The update removed the error, but a notification isn't appearing. |
At this time, the latest published package is not synced with the documentation. To build off of the example above. use Native\Laravel\Client\Client;
use Native\Laravel\Notification;
function createAndShowNotification() {
$client = new Client();
$notification->title('Hello from NativePHP')
->message('This is a detail message coming from your Laravel app.')
->show();
} Make sure you are invoking this from within the Electron (or eventually Tauri) since if you are using artisan commands or just visiting your site via the browser, there's nothing to receive the notification. And then of course, make sure you allow notifications from Electron (or eventually Tauri) and that you are not silencing them for example via your system notification center. |
You could also achieve this using only the Notification import since they have already initialised a client with the use Native\Laravel\Notification;
function createAndShowNotification() {
Notification::new()
->title('Hello from NativePHP')
->message('This is a detail message coming from your Laravel app.')
->show();
} |
There have been minor updates. Now you can write it like this: use Native\Laravel\Notification;
Notification::new()
->title('Hello from NativeApp')
->message('This is a detail message coming from your native app.')
->show(); |
@JordanDalton do you check your settings, Apple requires to allow for every single app permission to show notifications. |
Is there a way to change the icon on the notifications? Do see any docs for that. I am assuming that changing the icon for the app will automatically do that, but still not sure how to do that. |
The Notification facade was added in #25 and was released in v0.1.1 @abishekrsrikaanth please could you raise the icon issue as a feature request? |
@simonhamp the feature request templates was not working, is that fixed? |
@abishekrsrikaanth Yes I fixed that a little earlier today |
What happened?
I'm unable to successfully create a notification. I'm using the documentation from Native's website pertaining to Notifications.
I've noticed that the path to the facade,
Native\Laravel\Facades\Notification
, is not in Native's file path.Here's the shared trace for it: https://flareapp.io/share/95Jll42P
How to reproduce the bug
Use the following snippet from: https://nativephp.com/docs/1/the-basics/notifications
`use Native\Laravel\Facades\Notification;
Notification::title('Hello from NativePHP')
->message('This is a detail message coming from your Laravel app.')
->show();`
Package Version
0.1.0
PHP Version
8.2.8
Laravel Version
10.15.0
Which operating systems does with happen with?
macOS
Notes
No response
The text was updated successfully, but these errors were encountered: