-2

I’m new in working with Laravel and I want to clone a GitHub Laravel project to see how it works. I executed the commands: git clone, composer install and php artisan serve. I do get the laravel development server URL, but when I tried to run the project on the browser I get a server error 500. I feel that I’m missing some commands, If so, could you tell me which ones?

I appreciate your help.

1 Answers1

0

Yes, you are missing some commands. I had the same trouble a couple of moths ago, let me share with you some of my class notes on the steps you need to follow.

  1. Open the terminal.

  2. With the use of the command cd go te directory where you want save the project.

    Example: cd Desktop

  3. Execute de command: git clone [GitHub Repository URL]

    Example: git clone https://github.com/User/RepositoryName.git

  4. With the use of the command cd go te project directory.

    Example: cd Desktop Example: cd RepositoryName

    Note: You will probably just have to execute de last one, because you will be already in the Desktop directory if you executed the commands in order.

  5. Use the command: git status to know if your repository is updated.

    Example: git status

  6. Use the command: git fetch && git pull to update your local repository with the external repository.

    Example: git fetch && git pull

  7. Make sure you are in the outer developing branch (it is regularly named develop) of your project by executing the command git branch -a, it will display the branches and show you the current branch.

    Example: git branch -a

  8. Use the command git checkout branchName to move to the outer developing branch (it is regularly named develop).

    Example: git checkout develop

  9. In case of having your project divided in projectName and projectNameAPI you will have to execute the following commands in both directories.

    Example: cd projectName Example: Execute the step 10 commands

    Then used de cd .. command to return to de RepositoryName directory and then execute the cd projectNameAPI and execute the step 10 commands.

    Example: cd .. Example: cd projectNameAPI Example: Execute the step 10 commands

  10. Execute the following commands.

    npm I npm run dev composer install cp .env.example .env php artisan key:generate

In case of using a database, in this case XAMPP

  1. Open XAMPP and start the MySQL Database Server and the Apache Web Server

  2. Open XAMPP on your browser and on the URL write http://localhost/phpmyadmin/

    Example: http://localhost/phpmyadmin/

  3. Create a data base

  4. Go to privileges

  5. Add a new user account

  6. Enter a userName, select Local host and live the name that it has and click on generate password. Click on continue and live all the other fields as they appear.

  7. Open the env. file of you project and Enter the database name, the user and the password.

    Example: DB_DATABASE=databaseNamee DB_USERNAME=userName DB_PASSWORD=password

  8. Go to the terminal and go to the projectName directory or in case that you are using api go to the projectNameAPI directory and run the command php artisan migrate:fresh --seed

    Note: If you are using an API just run the command in the API directory.

    Example: cd Desktop Example: cd Project Example: cd RepositoryName Example: cd projectName Example: php artisan migrate:fresh --seed

  9. Positioned in your projectName directory run the project with the command php artisan serve

    Example: cd Desktop Example: cd Project Example: cd RepositoryName Example: cd projectName Example: php artisan serve

  10. The previous command will generate a URL, copy it and paste it on the URL of your browser and your project will start running.

Note: You can use the command ls to know what is inside the directory you are in. Note: You can use the command cd .. to move to a directory outter from where you are.