- Create a database in phpmyadmin. Open
.env
file and change following credentials
DB_HOST=127.0.0.1
DB_DATABASE=your_database_name
DB_USERNAME=your_database_user
DB_PASSWORD=your_database_password
-
You have two options to add the database schema:
- either import the
database.sql
file found in thedatabase
directory - or execute the migration command
php artisan migrate:refresh --seed
- either import the
-
Run
php artisan serve
to access the website at http://127.0.0.1:8000/ or http://localhost:8000
Before running Laravel inside Docker, please make sure you have installed docker
.
- Copy environment, docker-compose and Dockerfile
cp .env.docker.example .env
cp docker-conf/php/local.example docker-conf/php/Dockerfile
cp docker-compose.yml.example docker-compose.yml
- Run the following command to build the Docker image:
docker compose build
This command will download all the necessary dependencies and build the Docker image according to the specifications in the Dockerfile.
- Once the build is complete, run the following command to start the Docker container:
docker-compose up -d
- Run migration and seeder to migrate database. Note this command will refresh your databse also.
docker compose exec php php artisan migrate:refresh --seed
If you dont wan't to refresh databse run
docker compose exec php php artisan migrate --seed
- Once done, you can visit your website at http://localhost:8900/