Coder Social home page Coder Social logo

laradocstudyquick's Introduction

Install Laradoc

git clone https://github.com/Laradock/laradock.git
cd laradock
cp env-example .env
docker-compose up -d nginx mysql
docker-compose exec --user=laradock workspace bash
composer create-project --prefer-dist laravel/laravel app

Overriding defaults

edit .evn file

- APP_CODE_PATH_HOST=../
+ APP_CODE_PATH_HOST=../app

Running the project

Running the project is as simple as running

docker-compose stop
docker-compose up -d nginx mysql

the server runs at http://localhost

How do I get into a Docker container's shell?

docker-compose exec workspace bash

Set Up Database

Edit File

-DB_CONNECTION=mysql
-DB_HOST=127.0.0.1
-DB_PORT=3306
-DB_DATABASE=laravel
-DB_USERNAME=root
-DB_PASSWORD=
+DB_CONNECTION=mysql
+DB_HOST=mysql
+DB_PORT=3306
+DB_DATABASE=laravel
+DB_USERNAME=root
+DB_PASSWORD=root

Execute Dokcer

docker-compose exec mysql bash

> mysql -u root -proot

> create database laravel;

docker-compose exec workspace bash

> php artisan migrate

Uninstall Docker Container's

docker system prune
docker rmi $(docker images -q)

Create Test Code

php artisan make:test UserTest --unit

Run Test code

php artisan test

php artisan key:generate --env=testing

php artisan migrate --env=testing

php artisan make:test Database/DatabaseTest

いろいろポイントメモ

  • ControllerのCRUDを一気に作成
php artisan make:controller BookController --resource
  • キャッシュクリア
php artisan route:clear
  • サービスクラス

AppServiceProviderにサービスクラスを追加

protected $service;

public function __construct(TestService $service)
{
    $this->service = $service;
}
  • テスト実行
php artisan test
  • テストメソッドは、testとプレフィックス必要

laradocstudyquick's People

Contributors

harutotanabe09 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.