In the Quote Model file – app/Quote.php we need to state that the body field will be fillable.

protected $fillable = ['body'];

Now time to seed the database with our dummy data.

php artisan migrate --seed

Creating our Twitter credentials

We now need to get our Twitter credentials go to the following URL https://apps.twitter.com/. You need sign into the twitter account which you want to send the tweets from, Once signed in click on Create New App

Fill in the fields for website just use your development enviroment URL. If you haven’t got a production url. Then agree to the terms.

Click on – “Manage keys and access tokens”. To generate your keys and tokens. On the the next page click on “Create my Access Token”.

Our Twitter command is now built if you go back to the command line enter the following below to see our artisan command. We will now see our command in the artisan list

php artisan list

With the command built we can send out a random tweet again from the command line enter the following below

php tweets:send

Automating our Twitter Command

The final stage left is to schedule our tweet. I recommend reading this link from the Laravel documention http://laravel.com/docs/5.1/scheduling. Now go back to the app/Console/Kernel.php file. We going to send a tweet every hour at 3am.