Adding project folders into your Homestead

If you create a Laravel project in homestead, you will notice that the project folder in your local machine is empty - while the newly created Laravel app is up and running. This might very well due to your mapping in `homestead.yaml` file isn't correct. 

Let's elaborate more, if you use Laravel homestead, to create a project using the command:

laravel new AppName

We run the command above in the vbox machine as guest machine. This will create a folder `AppName` in your guest machine. The app is working. You may think that mapping this way will do the work assuming you already have `project1`:

#- map: ~/code/project2
#  to: /home/vagrant/code/project2

You will see that your `project2` folder is empty in your local machine.

To fix this, I'd suggest this approach - first create a new mapping path (a general path from the local machine's project directory to the vagrant's code directory / project directory whatever you use in vagrant). You can do this by updating your YAML file. Then, do a re-provision, you can do this while you have the vagrant box up and running.

#- map: ~/code
#  to: /home/vagrant/code

Now, run the create new project command and update the YAML file with the actual path to your new Laravel app. 

laravel new AppName

#- map: ~/code/project2
#  to: /home/vagrant/code/project2

 

Comments