If you are interested in executing a command to the remote Heroku Application in the cloud and not the local machine, you can use the following example for a laravel application I was creating today.

The following command simply runs php artisan command to my Heroku application from my terminal in my local computer

$ heroku run php artisan migrate