Skip to content

vinhyenvodoi98/workflow_management_php_laravel

Repository files navigation

Workflow management👋

Description

Feature

Contribute

vs code js cài đặt plusin prettier, Trailing Space

  • Prettier setup

Ctrl + ,-> search prettier

"prettier.arrowParens": "always"
"prettier.endOfLine": "auto"
"prettier.jsxSingleQuote": true
"prettier.jsxBracketSameLine": false
"prettier.semi": true
"prettier.singleQuote": true
"prettier.tabWidth": 2

Ctrl + ,-> search Format on save

"editor.formatOnSave": true

Process

  1. Fork
  2. Pull branch master
  3. Check issue in Project on Github (u can create new issue if need)
  4. Create new branch from branch master and code
  5. Create pull request with detail description (may be with some screenshot) and wait for review
  6. After merge, pull new code from master

Run

Laravel

composer install

composer update

# Create Application Key
php artisan key:generate

# Pulish file config jwt:
php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\LaravelServiceProvider"

# Create Jwt Key
php artisan jwt:secret

Reactjs

yarn install

or

npm install
npm run watch

khi run lệnh trên mỗi khi bạn save file nó sẽ auto biên dịch mã javascript đến thư mục public/js/app.js

Start everything with docker-compose

docker-compose up -d

Create database

  • First, regenerate Composer's autoloader
composer dump-autoload
  • If you do not have any database created yet, run migration scripts to create database tables
docker-compose exec app php artisan migrate
  • If you have already had a database before, you can Rollback & Migrate
docker-compose exec app php artisan migrate:refresh
  • OR Drop All Tables & Migrate
docker-compose exec app php artisan migrate:fresh --seed
  • Create a little of sample data for testing if you want
docker-compose exec app php artisan db:seed

If you want to check database

For the first time

docker run --name mariadb -e MYSQL_ROOT_PASSWORD=123456 -d mariadb:10.3
docker run -it --link mariadb:mysql --rm mariadb:10.3 sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"'

Access to database for checking

docker exec -it <db_container_ID> bash

mysql -u root -p

password is in docker-compose when you setup and run in MYSQL_ROOT_PASSWORD: 123456

Test create contact.php seeds contractsTableSeeder.php factories ContractFactory.php

follow this https://blog.digitalocean.com/create-simple-contacts-laravel-postgresql/

To show logs form container

docker logs -f --details containerName

Test

Firstly, we have to go into our app Laravel container.

docker exec -it <app_container_ID> bash

Then, run the following command to test:

./vendor/bin/phpunit

Write your own TestCase

php artisan make:test <TestCaseClass>