I have to run migrations on the homestead box by SShing in:
homestead ssh
cd ~/Code/my-project
php artisan migrate
I would prefer to just run migrate
on the local folder and automatically have the migrations run on the guest (virtual) machine.
By default, Laravel uses the localhost as the database host, just go to your homestead.yaml file and check the first line for the IP address (possibly is => ip: "192.168.10.10"). Use this IP as the host in your .env file:
In the .env file use: DB_HOST=192.168.10.10
Instead of DB_HOST=localhost
It must works.
PS: Homestead redirect the ports also, so possibly you need to change the port of the database to: 33060
In the .env file, use: DB_PORT=33060
, instead of DB_PORT=3306
But, check first with the firt configuration.
Best wishes.