jorenvh / laravel-share

Optional package for Laravel to generate social share links.
MIT License
529 stars 88 forks source link

Add whatsapp #19

Closed JunaidQadirB closed 5 years ago

JunaidQadirB commented 6 years ago

Please add whatsapp.

Regards

jorenvh commented 6 years ago

I accept a good PR to add Whatsapp support

josephadah commented 6 years ago

I'm also in support for this PR to add Whatsapp

vipertecpro commented 6 years ago

I think i've achieved to apply whatsapp share link, all you need to do is to change in the followings files :-

Go to : config/laravel-share.php Add this to services :

        'whatsapp' => [
            'uri' => 'https://wa.me/?text=',
            'extra' => ['mini' => 'true']
        ], 

Go to : resources/lang/vendor/laravel-share/en/laravel-share-fa4.php Add this to return :

'whatsapp' => '<li ><a target="_blank" href=":url" class=":class" id=":id"><span class="fa fa-whatsapp"></span></a></li>',

Go to : vendor\jorenvanhocht\laravel-share\src\Share.php Add new function :

    /**
     * Whatsapp share link
     *
     * @return $this
     */
    public function whatsapp()
    {
        $url = config('laravel-share.services.whatsapp.uri') . $this->url;

        $this->buildLink('whatsapp', $url);

        return $this;
    }

Go to : vendor\jorenvanhocht\laravel-share\config\laravel-share.php Add this to services :

        'whatsapp' => [
            'uri' => 'https://wa.me/?text=',
            'extra' => ['mini' => 'true']
        ], 

Go to : vendor/jorenvanhocht/laravel-share/resources/lang/en/laravel-share-fa4.php Add this to return : 'whatsapp' => '<li><a href=":url" class="social-button :class" id=":id"><span class="fa fa-whatsapp"></span></a></li>',

Finally Use it in blade :-

{!!
     Share::page('http://jorenvanhocht.be', null, [], '', '')->facebook()->twitter()->googlePlus()->whatsapp()
!!}
pqrs commented 5 years ago

Hi @jorenvh! I needed this whatsapp feature and took this code above by @vipertecpro and implemented it in a new fork. You can see it in pqrs/laravel-share.

I added a test for WhatsApp and it passes. I think everything is ok but I'm fairly new to all this about forks and pull requests and don't know exactly what to do to merge it (if you want, of course).

Best!

jorenvh commented 5 years ago

hi @pqrs can you create a PR for that fork please?

pqrs commented 5 years ago

Sure! Let me know if it’s ok.

jorenvh commented 5 years ago

PR #30 by @pqrs was just merged into master. A new release will be tagged later today.

Thanks again @pqrs for contributing to this package

vipertecpro commented 5 years ago

I feel so blessed, that my code is going to be in someone else's new update (or even a small fix). That's only because the dev-master who wrote such a flexible code, if possible i would like to add all the social media around the web in it because well that's what this repo is for. Thank you so much again. Keep on updating and patching.

pqrs commented 5 years ago

Thanks to you, @vipertecpro. As you see my PR is your code as you submitted so all the credit should be yours. I’m too for adding more social shares, I see someone proposed Pinterest a while ago. I’ll try when I find some time.

Cheers!