Skip to content

Instantly share code, notes, and snippets.

@nncl
Last active August 11, 2017 13:57
Show Gist options
  • Save nncl/3bbcb8609655b3e7a4a9 to your computer and use it in GitHub Desktop.
Save nncl/3bbcb8609655b3e7a4a9 to your computer and use it in GitHub Desktop.
Laravel Enviroment tips and stuff

Laravel Enviroment

This items are based on feedback that I had on the first time I touched on Laravel stuff.

[Mário's tutorial] (https://www.youtube.com/watch?v=D1D2g7yEgCM&feature=youtu.be).

Steps

Host configuration

  1. At the root of your project, run vi .homestead/Homestead.yaml
  2. Add all jobs in sites section
  3. Add also the website on your hosts file - sudo vi /etc/hosts
  4. Save and exit
  5. Run cd Homestead > vagrant provision - to new jobs added
  6. Run cd Homestead > vagrant up - to jobs that already live there

Creating the project

On the directory that we want to create the job path - Documents/jobs/dev, p. ex....

  1. composer create-project laravel/laravel project-name

To generate key, run php artisan key:generate or go to [Laravel Recipes] (http://laravel-recipes.com/recipes/283/generating-a-new-application-key) and copy and paste it.

Cloning Repo

  1. Run composer install
  2. Run npm install
  3. Run bower install
  4. Run gulp

Probable errors

  1. If you clone a project and gives error on the main screen, thats you need to run sudo composer install
  2. And then go to [Laravel Recipes] (http://laravel-recipes.com/recipes/283/generating-a-new-application-key) to generate a new key, duplicate the .env.example file, rename to just .env and paste the key in APP_KEY
  3. Error: Cannot find module 'laravel-elixir'. To resolve this, do this, you need to run npm install
  4. npm ERR! EEXIST, open [...] bdfc06e-pm-source-map-0-1-43-package-tgz.lock Move it away, and try again.

That's because your node version is getting errors, as you can see here. The solution that I had was reinstall the node. What I've done:

  • Run brew uninstall node
  • brew install node
  • sudo brew postinstall node # brew error message provided this recommendation; only worked with sudo
  • Then npm install again.

Or even try:

  • Run npm -g install npm@next or npm -g install npm@2.1.1.

Working with admin panel and the website

Yeah, at Din we work with two areas: the panel and the website.

Admin area

First of all, let's talk about admin area. Follow these steps:

  1. Clone the repo
  2. Create the schema on MYSQL Workbench
  3. Sync the database
  4. Import the stuff on vagrant ssh
  5. Run composer update
  6. Create and edit your config.local.php file

The end, by now.

Website area

So, follow these steps now:

  1. Update your repo going to dev branch, or whatever is the development branch
  2. Delete rm -rf the vendor directory
  3. DO NOTDelete rm -rf the composer.lock file. Credits to Levi
  4. Run composer install

Probably this area is working now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment