SocialSharingRepository.php 7.91 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
<?php

namespace App\Repositories\Webprofile;

use Toolkito\Larasap\SendTo;

class SocialSharingRepository
{
    /**
     * Function For Telegram.
     */
    public function sendTextMessageToTelegram()
    {
        SendTo::Telegram('Hello, This is testing Laravel social auto posting');
        dd('Youe message send successfully!!');
    }

    public function sendPhotoToTelegram()
    {
        SendTo::Telegram(
            'Hello, Im testing Laravel social auto posting', // Photo caption (Optional)
            [
                'type' => 'photo', // Message type (Required)
                'file' => 'https://i.imgur.com/j6bzKQc.jpg', // Image url (Required)
            ],
            '' // Inline keyboard (Optional)
        );
        dd('Youe message send successfully!!');
    }

    public function sendAudioToTelegram()
    {
        SendTo::Telegram(
            'Hello, Im testing Laravel social auto posting', // Audio caption (Optional)
            [
                'type' => 'audio', // Message type (Required)
                'file' => 'http://example.com/let-me-be-your-lover.mp3', // Audio url (Required)
                'duration' => 208, // Duration of the audio in seconds (Optional)
                'performer' => 'Enrique Iglesias', // Performer (Optional)
                'title' => 'Let Me Be Your Lover', // Track name (Optional)
            ],
            '' // Inline keyboard (Optional)
        );
        dd('Youe message send successfully!!');
    }

    public function sendDocumentToTelegram()
    {
        SendTo::Telegram(
           'Hello, Im testing Laravel social auto posting', // Document caption
           [
               'type' => 'document', // Message type (Required)
               'file' => 'http://example.com/larasap.pdf', // Document url (Required)
           ],
          '' // Inline keyboard (Optional)
        );
        dd('Youe message send successfully!!');
    }

    public function sendVideoToTelegram()
    {
        SendTo::Telegram(
            'Hello, Im testing Laravel social auto posting', // Video caption (Optional)
            [
                'type' => 'video', // Message type (Required)
                'file' => 'http://example.com/let-me-be-your-lover.mp4', // Audio url (Required)
                'duration' => 273, // Duration of sent video in seconds (Optional)
                'width' => 1920, // Video width (Optional)
                'height' => 1080, // Video height (Optional)
            ],
            '' // Inline keyboard (Optional)
        );
        dd('Youe message send successfully!!');
    }

    public function sendVoiceToTelegram()
    {
        SendTo::Telegram(
            'Hello, Im testing Laravel social auto posting', // Voice message caption (Optional)
            [
                'type' => 'voice', // Message type (Required)
                'file' => 'https://upload.wikimedia.org/wikipedia/en/9/9f/Sample_of_%22Another_Day_in_Paradise%22.ogg', // Audio url (Required)
                'duration' => 28, // Duration of the voice message in seconds (Optional)
            ],
            '' // Inline keyboard (Optional)
        );
        dd('Youe message send successfully!!');
    }

    public function sendMediaGroupToTelegram()
    {
        SendTo::Telegram(
           null,
           [
               'type' => 'media_group', // Message type (Required)
               'files' => // Array describing photos and videos to be sent, must include 2–10 items
               [
                   [
                       'type' => 'photo', // Media type (Required)
                       'media' => 'https://i.imgur.com/j6bzKQc.jpg', // Media url (Required)
                       'caption' => 'Laravel sccial auto posting', // Media caption (Optional)
                   ],
                   [
                       'type' => 'video', // Media type (Required)
                       'media' => 'http://example.com/let-me-be-your-lover.mp4', // Media url (Required)
                       'caption' => 'Let me be your lover', // Media caption (Optional)
                   ],
               ],
           ]
        );
        dd('Youe message send successfully!!');
    }

    public function sendPointOnTheMapToTelegram()
    {
        SendTo::Telegram(
            null,
            [
                'type' => 'location', // Message type (Required)
                'latitude' => 36.1664345, // Latitude of the location (Required)
                'longitude' => 58.8209904, // Longitude of the location (Required)
                'live_period' => 86400, // Period in seconds for which the location will be updated (Optional)
                // '' // Inline keyboard (Optional)
            ]
        );
        dd('Youe message send successfully!!');
    }

    public function sendInformationAboutVenueToTelegram()
    {
        SendTo::Telegram(
            null,
            [
                'type' => 'venue', // Message type (Required)
                'latitude' => 36.166048, // Latitude of the location (Required)
                'longitude' => 58.822121, // Longitude of the location (Required)
                'title' => 'Khayyam', // Name of the venue (Required)
                'address' => 'Neyshabur, Razavi Khorasan Province, Iran', // Address of the venue (Required)
                'foursquare_id' => '', // Foursquare identifier of the venue (Optional)
                // '', // Inline keyboard (Optional)
            ]
        );
        dd('Youe message send successfully!!');
    }

    public function sendMessageWithInlineButtonToTelegram()
    {
        SendTo::Telegram(
            'Laravel social auto posting',
            '',
            [
                [
                    [
                        'text' => 'Github',
                        'url' => 'https://github.com/toolkito/laravel-social-auto-posting',
                    ],
                ],
                [
                    [
                        'text' => 'Download',
                        'url' => 'https://github.com/toolkito/laravel-social-auto-posting/archive/master.zip',
                    ],
                ],
            ]
        );

        // OR

        SendTo::Telegram(
            'Laravel social auto posting',
            '',
            [
                [
                    [
                        'text' => 'Github',
                        'url' => 'https://github.com/toolkito/laravel-social-auto-posting',
                    ],
                    [
                        'text' => 'Download',
                        'url' => 'https://github.com/toolkito/laravel-social-auto-posting/archive/master.zip',
                    ],
                ],
            ]
        );

        dd('Youe message send successfully!!');
    }

    /**
     * Function For Twitter.
     */
    public function sendTextTweet($twit)
    {
        SendTo::Twitter($twit);
        // dd('Youe message send successfully!!');
    }

    public function sendTweetWithMedia($twit, $img)
    {
        SendTo::Twitter(
            $twit, $img
        );
        // dd('Youe message send successfully!!');
    }

    /**
     * Function For Facebook.
     */
    public function sendLinkToFacebook($link, $message)
    {
        SendTo::Facebook(
            'link',
            [
                'link' => $link,
                'message' => $message,
            ]
        );
        dd('Youe message send successfully!!');
    }

    public function sendPhotoToFacebook($image_url, $message)
    {
        SendTo::Facebook(
            'photo',
            [
                'photo' => $image_url,
                'message' => $message,
            ]
        );
        dd('Youe message send successfully!!');
    }

    public function sendVideoToFacebook($video_url, $title, $description)
    {
        SendTo::Facebook(
            'video',
            [
                'video' => $video_url,
                'title' => $title,
                'description' => $description,
            ]
        );
        dd('Youe message send successfully!!');
    }
}