LaravelでSQLの実行結果が簡単にわかるプロファイラー機能
Laravel3.1になり、Bandle(プラグイン)として提供されていたSQLプロファイラーのAnbuが標準で組み込まれることになり、LaravelでもCakePHPのようなSQL実行結果が簡単にわかるようになったようです。このプロファイラーはCake同様、ページの下部に固定される形に表示されるわけですが、標準ではオフになっているので、有効にするには、以下のように設定する必要があります。
- application/config/application.phpを開く
- Profilerの項目をfalseからtrueに変更して保存
<?php /* 中略 */ /* |-------------------------------------------------------------------------- | Profiler Toolbar |-------------------------------------------------------------------------- | | Laravel includes a beautiful profiler toolbar that gives you a heads | up display of the queries and logs performed by your application. | This is wonderful for development, but, of course, you should | disable the toolbar for production applications.. | */ 'profiler' => true,
DBに接続しているページを表示してみれば、下のような具合で、SQLの実行結果が確認できます。