Skip to content

Instantly share code, notes, and snippets.

@alphaolomi
Forked from JemCdo/setting_up_laravel_app.md
Last active October 6, 2019 18:11
Show Gist options
  • Save alphaolomi/fe0e100283026a305343bfdbab57a070 to your computer and use it in GitHub Desktop.
Save alphaolomi/fe0e100283026a305343bfdbab57a070 to your computer and use it in GitHub Desktop.
How to clone and set up a laravel app

Setting up a Laravel

Using a git repository

  • Step 1: Clone repository

    git clone https://....
  • Step 2: Install required dependecies

    composer install
    
  • Step 3: Create a Database

    mysql --user=root --password="" -e "CREATE DATABASE database_name"

    NOTE: mysql has to me added to $PATH environment

  • Step 4: Rename .env.example file -> .env

    cp .env.example .env
  • Step 5: Generate application key

    php artisan key:generate
  • Step 6: Copy and Replace the following configuration to your new .env file

    DB_DATABASE=database_name
    DB_USERNAME=root
    DB_PASSWORD=
  • Step 7: Run migrations and seeds

    php artisan migrate:fresh --seed
    
  • Step 8: Install dependencies in your node_modules folder:

    npm install
    • If you want to watch all the changes you make in the application then run the following command in the root directory.
    npm run watch
    
    • To run the project you need to run following command in the project directory. It will compile the vue files & all the other project files. If you are making any changes in any of the .vue file then you need to run the given command again.
    npm run dev
    
    • If you want to run the project and make the build in the production mode then run the following command in the root directory, otherwise the project will continue to run in the development mode.
    npm run prod
  • Step 8: Lunch the application on browser

    php artisan serve
    

    To change the port address, run the following command:

    php artisan serve --port=8080 // For port 8080
    sudo php artisan serve --port=80 // If you want to run it on port 80, you probably need to sudo.
  • Step 8: Opening on browser

    Open http://127.0.0.1:8000/

** Required Permissions **

If you are facing any issues regarding the permissions, then you need to run the following command in your project directory:

sudo chmod -R o+rw bootstrap/cache
sudo chmod -R o+rw storage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment