LoginSignup
1
3

More than 5 years have passed since last update.

Laravelインストール付随作業(ローカル開発環境)

Posted at

Laravelインストール付随作業(ローカル開発環境)

composer インストール・パス通し

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

環境移行後初回に実行

composer install
composer update

.envファイル複製

cp .env.example .env

.envファイル作成後にキー生成

php artisan key:generate

.htaccessの下層オーバーライドを許可

vi /etc/httpd/conf/httpd.conf

<Directory "/var/www/html/public">
- AllowOverride None
+ AllowOverride All
</Directory>

IDEヘルパーファイル生成(barryvdh/laravel-ide-helperのインストールが必要)

php artisan ide-helper:generate

オートロードファイル更新

composer dump-autoload

パーミッション変更(-Rでディレクトリ内も再起処理)

chmod -R 777 /var/www/html/storage/logs

Artisan コマンド チートシート

  • コンフィグキャッシュファイルクリア・再キャッシュ

    php artisan config:cache

  • ルーティングリスト確認

    php artisan route:list

  • ルーティングキャッシュファイルクリア・再キャッシュ

    php artisan route:cache

  • ビューファイルクリア

    php artisan view:clear

  • クラスファイル最適化

    php artisan optimize

  • 各生成コマンド

    • サービスプロバイダ登録
      php artisan make:provider TestServiceProvider
    • イベント
      php artisan event:generate TestEventServiceProvider
  • マイグレーション

    • マイグレーションテーブル作成
      php artisan migrate:install
    • マイグレーションテーブル削除
      php artisan migrate:reset
    • マイグレーション実行
      php artisan migrate
    • ロールバック
      php artisan migrate:rollback
    • リフレッシュ(ロールバック + 再マイグレート)
      php artisan migrate:refresh
    • リフレッシュ(シードも実行)
      php artisan migrate:refresh --seed
    • 指定のマイグレーション実行
      php artisan migrate --class=CreateTestsTable
    • 指定のシーダー実行
      php artisan db:seed --class=SampleSeeder
    • テストテーブル作成(テーブル作成例)
      php artisan make:migration create_tests_table --create=tests
    • 記事テーブルに公開日カラム追加(スキーマ変更例)
      php artisan make:migration add_published_at_to_articles_table --table=articles
    • 強制マイグレート実行(production環境での -y と同等) php artisan migrate --force
1
3
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
1
3