LoginSignup
83
76

More than 5 years have passed since last update.

Laravelで実行されたSQLを確認する

Last updated at Posted at 2017-08-02

メモ

$ php artisan --version

Laravel Framework 5.4.23
.
.
.

use DB;

.
.
.

// 確認したいSQLの前にこれを仕込んで
DB::enableQueryLog();

// 確認したいSQL
$articles = Article::all();

// dumpする
dd(DB::getQueryLog());

.
.
.

=====>

array:1 [▼
  0 => array:3 [▼
    "query" => "select * from `articles`"
    "bindings" => []
    "time" => 15.62
  ]
]
83
76
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
83
76