Skip to content
オープンソース・ワークショップ 永原 篤 edited this page Apr 12, 2020 · 1 revision

XAMPP でMySQL のクエリログを出力する。  

my.ini
[mysqld]
general_log=ON
general_log_file=/xampp/laravel_path/storage/logs/query.log

hasMany 使用時のSQL 発行回数確認

Model をget() で複数(Collection で)取得
View でCollection をループ
Model はhasMany を使って、子テーブルを定義済み
View でModel の子テーブルのcount() メソッドを使用。
ループの回数、SQL が発行される。
まあ、当然かな。レスポンスが要求される処理は要注意。

Clone this wiki locally