Skip to content

Support Laravel 5.4+ - #5

Open
cschalenborgh wants to merge 1 commit into
padosoft:masterfrom
cschalenborgh:patch-1
Open

Support Laravel 5.4+#5
cschalenborgh wants to merge 1 commit into
padosoft:masterfrom
cschalenborgh:patch-1

Conversation

@cschalenborgh

Copy link
Copy Markdown

share() is removed in Laravel 5.4.
Here's the fix:

php artisan vendor:publish --provider="Padosoft\AffiliateNetwork\AffiliateNetworkServiceProvider"
   Symfony\Component\Debug\Exception\FatalThrowableError  : Call to undefined method Illuminate\Foundation\Application::share()

Fixes this issue:

```
php artisan vendor:publish --provider="Padosoft\AffiliateNetwork\AffiliateNetworkServiceProvider"
   Symfony\Component\Debug\Exception\FatalThrowableError  : Call to undefined method Illuminate\Foundation\Application::share()
```

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Updates the package’s Laravel service provider registration to be compatible with Laravel 5.4+, where Application::share() is no longer available.

Changes:

  • Replaces the deprecated $this->app->share(...) binding with a $this->app->singleton(...) binding in the service provider.
Comments suppressed due to low confidence (1)

src/AffiliateNetworkServiceProvider.php:41

  • The container binding here registers a singleton for Connection::class, but this class isn’t imported/defined in this package (so Connection::class resolves to Padosoft\AffiliateNetwork\Connection and will fatally error). It also doesn’t match the instance being returned (new NetworkManager()) or the subsequent alias/provides entries that reference NetworkManager. Bind the singleton under 'NetworkManager' (or NetworkManager::class) and align alias()/provides() to the same abstract.
        $this->app->singleton(Connection::class, function ($app) {
            return new NetworkManager();
        });
        $this->app->alias('NetworkManager', NetworkManager::class);
    }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants