PHP code example of claraleigh / autotweet-for-laravel

1. Go to this page and download the library: Download claraleigh/autotweet-for-laravel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

claraleigh / autotweet-for-laravel example snippets


$casts = [
    // Existing casts
    'twitter_token' => 'object',
];

public function via(object $notifiable): array
{
    return [TwitterChannel::class];
}

public function toTwitter($notifiable): TwitterMessage
{
    $post = (new TwitterStatusUpdate(
        __('Come see visit profile :url ❤️', ['url' => 'https://google.com/'])
    ));
   
    // Optional: Add an image to the tweet
    $post->withImage('path/to/image.jpg');

    return $post;
}

AutotweetForLaravelServiceProvider::useUserModel(ExampleModel::class);
bash
php artisan vendor:publish --tag="autotweet-for-laravel-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="autotweet-for-laravel-config"