slack-laravel icon indicating copy to clipboard operation
slack-laravel copied to clipboard

Remove share method

Open MyMediaMagnet opened this issue 8 years ago • 7 comments

MyMediaMagnet avatar Jan 25 '17 00:01 MyMediaMagnet

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()

paultibbetts avatar Jan 25 '17 12:01 paultibbetts

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

connorjburton avatar Jan 25 '17 21:01 connorjburton

@connorjburton This is the right approach.

Tlapi avatar Jan 26 '17 10:01 Tlapi

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

Tlapi avatar Jan 26 '17 10:01 Tlapi

See #11

connorjburton avatar Jan 26 '17 11:01 connorjburton

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

PixellUp avatar May 20 '17 10:05 PixellUp

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

skecskes avatar Dec 27 '17 01:12 skecskes