LoginSignup
10
9

More than 5 years have passed since last update.

Laravel5 で別環境(APP_ENV)で artisan コマンドを実行

Posted at

--env={APP_ENV} オプションを指定することで、DBの接続先など .env.{APP_ENV} の中身を読み込んでコマンドを実行してくれる。

# .env.testing を読み込んで migrate と seed を実行
php artisan migrate --seed --env=testing

「テストを別DBで実行するため、事前にマイグレーション走らせておきたい」というときなどに便利。

10
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
9