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

Problem with lumen 8 - call to a member function resolved on null #158

Open
sopheary opened this issue Oct 22, 2022 · 3 comments
Open

Problem with lumen 8 - call to a member function resolved on null #158

sopheary opened this issue Oct 22, 2022 · 3 comments

Comments

@sopheary
Copy link

[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}
"}

@sopheary sopheary changed the title Problem with lumen 8 Problem with lumen 8 - call to a member function resolved on null Oct 22, 2022
@irazasyed
Copy link
Member

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.

@sopheary
Copy link
Author

Thank you for your reply. I already installed "illuminate/notifications": "^8.83" before I got the above error.

@NextStepOfEvolution
Copy link

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));
        });
    }
}

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

No branches or pull requests

3 participants