3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

完全に自分用作業メモ

  • 2015年11月29日位の情報
  • Laravel 5.1

インストール

composer global require "laravel/installer"

PATHの設定

~/.composer/vendor/bin
.zshrc
## laravel homestead
export PATH=$HOME/.composer/vendor/bin:$PATH

laravel コマンド

laravel new [ディレクトリ名]

プロジェクトの作成

composer create-project laravel/laravel your-project-name --prefer-dist

基本設定

config/の下に設定ファイルがある。

パーミッションの設定

Laravel4 の場合以下。

  • /app/storage

Laravel5の場合、以下。

  • /storage
  • bootstrap/cache

アプリケーション・キー

  • ComposerかLaravelインストーラーでインストールした場合は、既に設定されているはず。key:generateコマンドで。
  • .env 環境ファイルに入っている
  • 設定されていなかったら、 .env.example ファイルを .envに名前変更して、設定する

追加の設定

これで基本的な設定は終わり

  • config/app.php ファイルをみてもいいかも
  • timezone や locale など。

Pretty URL

  • ApacheとNginxの設定をする
  • Homesteadの場合は、既にしてある

DotEnv

環境設定切り替えツールとして、以下を使っている様子

設定値にアクセスする

$value = config('app.timezone');
config(['app.timezone' => 'America/Chicago']);

アプリ名をつける

php artisan app:name Horsefly

Laravel の artisanコマンド

その他

  • laravel new datatables

トラブルシューティング

composerを使うと以下が出る場合

[Symfony\Component\Debug\Exception\FatalErrorException]
  Class 'yajra\Datatables\DatatablesServiceProvider' not found
  [Symfony\Component\Debug\Exception\FatalErrorException]
  Class 'Barryvdh\Debugbar\ServiceProvider' not found

config/app.php

以下でなおったっぽい。

composer update --no-scripts

こんなやり方もあるかも

composer self-update
composer update

DBが使えない

Homesteadを使っているのに、homestead上でなくて、ローカルからDBコマンドを叩こうとして、エラーになる

以下のようなコマンドは、homestead sshした先で実行する

php artisan migrate
php artisan db:seed

3
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
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?