Skip to content

Latest commit

 

History

History
79 lines (64 loc) · 2.17 KB

1.laravel.md

File metadata and controls

79 lines (64 loc) · 2.17 KB

Laravel Example App

Configure the Application

Clone this repo

git clone [email protected]:DNXLabs/ChallengeDevOps.git

Switch to the repo folder

cd ChallengeDevOps

Install all the dependencies using composer

composer install

Copy the example env file and make the required configuration changes in the .env file

cp .env.example .env

Generate a new application key

php artisan key:generate

Generate a new JWT authentication secret key

php artisan jwt:generate

Install MySQL

Windows: https://dev.mysql.com/doc/refman/8.0/en/windows-installation.html
MacOS: https://dev.mysql.com/doc/refman/8.0/en/macos-installation.html

Run the database migrations
(Make sure you set the correct database connection information in your .env before running the migrations)

php artisan migrate

If you get the following error:

SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client (SQL: select * from information_schema.tables where table_schema = mentoring2022 and table_name = migrations and table_type = 'BASE TABLE')

Try changing your database root pass:

ALTER USER 'root'@"localhost" IDENTIFIED WITH mysql_native_password BY 'YOUR_PASS'

Start the local development server

php artisan serve

You can now access the server at http://localhost:8000

Database seeding

Populate the database with seed data with relationships which includes users, articles, comments, tags, favorites and follows.
This can help you to quickly start testing the api or couple a frontend and start using it with ready content.

Open the DummyDataSeeder and set the property values as per your requirement

database/seeds/DummyDataSeeder.php

Run the database seeder and you're done

php artisan db:seed

Note : It's recommended to have a clean database before seeding. You can refresh your migrations at any point to clean the database by running the following command

php artisan migrate:refresh