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

Remove share method #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

MyMediaMagnet
Copy link

No description provided.

The share method has been remove in Laravel 5.4 and the singleton method should be used instead.
@paultibbetts
Copy link

This PR fixed the following error I got after updating to 5.4

> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan optimize
PHP Fatal error:  Call to undefined method Illuminate\Foundation\Application::share() in /Users/.../vendor/maknz/slack-laravel/src/ServiceProviderLaravel5.php on line 29


  [Symfony\Component\Debug\Exception\FatalErrorException]
  Call to undefined method Illuminate\Foundation\Application::share()

@connorjburton
Copy link

That solves the undefined method but I found it didn't actually work with just that change, this is what I did to get it working:

Note the bind is now a class reference rather than a string, as detailed in the upgrade guide. https://laravel.com/docs/5.4/upgrade (Search for Binding Classes With Leading Slashes) and you don't need to assign $this->app->singleton to anything.

public function register()
    {
        $this->mergeConfigFrom(__DIR__.'/config/config.php', 'slack');

        $this->app->singleton('maknz.slack', function ($app) {
            return new Client(
                $app['config']->get('slack.endpoint'),
                [
                    'channel' => $app['config']->get('slack.channel'),
                    'username' => $app['config']->get('slack.username'),
                    'icon' => $app['config']->get('slack.icon'),
                    'link_names' => $app['config']->get('slack.link_names'),
                    'unfurl_links' => $app['config']->get('slack.unfurl_links'),
                    'unfurl_media' => $app['config']->get('slack.unfurl_media'),
                    'allow_markdown' => $app['config']->get('slack.allow_markdown'),
                    'markdown_in_attachments' => $app['config']->get('slack.markdown_in_attachments'),
                ],
                new Guzzle
            );
        });

        $this->app->bind(Maknz\Slack\Client::class, 'maknz.slack');
    }

@Tlapi
Copy link

Tlapi commented Jan 26, 2017

@connorjburton This is the right approach.

@Tlapi
Copy link

Tlapi commented Jan 26, 2017

@connorjburton Willing to make pull request? @maknz Willing to merge?

@connorjburton
Copy link

See #11

@PixellUp
Copy link

I think this repo is dead and should be transferred to organization or person who will maintain it. @maknz

@skecskes
Copy link

I just made a fork and fixed it there: if anybody is interested: https://github.com/phpify/slack-laravel or just composer require phpify/slack-laravel

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.

6 participants