Open sopheary opened 1 year ago
Lumen doesn't support notifications out of the box. You need to set it up.
Install the illuminate/notifications
package and then follow the instructions given here.
Please update this issue ticket once you try.
Thank you for your reply. I already installed "illuminate/notifications": "^8.83" before I got the above error.
Solve this error by edit TelegramServiceProvider.php
<?php
namespace NotificationChannels\Telegram;
use Closure;
use GuzzleHttp\Client as HttpClient;
use Illuminate\Notifications\ChannelManager;
use Illuminate\Support\Facades\Notification;
use Illuminate\Support\ServiceProvider;
/**
* Class TelegramServiceProvider.
*/
class TelegramServiceProvider extends ServiceProvider
{
/**
* Register the application services.
*/
public function register(): void
{
$this->app->bind(Telegram::class, static fn () => new Telegram(
config('services.telegram-bot-api.token'),
app(HttpClient::class),
config('services.telegram-bot-api.base_uri')
));
}
public function booted(Closure $callback)
{
Notification::resolved(static function (ChannelManager $service) {
$service->extend('telegram', static fn ($app) => $app->make(TelegramChannel::class));
});
}
}
[2022-10-22 07:01:30] local.ERROR: Call to a member function resolved() on null {"exception":"[object] (Error(code: 0): Call to a member function resolved() on null at D:\sopheary_project\email_service\vendor\illuminate\support\Facades\Facade.php:36) [stacktrace]
0 D:\sopheary_project\email_service\vendor\laravel-notification-channels\telegram\src\TelegramServiceProvider.php(32): Illuminate\Support\Facades\Facade::resolved(Object(Closure))
1 D:\sopheary_project\email_service\vendor\laravel\lumen-framework\src\Application.php(233): NotificationChannels\Telegram\TelegramServiceProvider->register()
2 D:\sopheary_project\email_service\bootstrap\app.php(29): Laravel\Lumen\Application->register(Object(NotificationChannels\Telegram\TelegramServiceProvider))
3 D:\sopheary_project\email_service\public\index.php(14): require('D:\\sopheary_pro...')
4 {main}
"}