Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

how get query logs in laravel

Method #1
instead of ->get use ->toSql() on query 
$users = User::orderBy('name', 'asc')->toSql();

echo $users;

// Outputs the string:
'select * from `users` order by `name` asc'
Method # 2

DB::enableQueryLog();

// and then you can get query log

dd(DB::getQueryLog());
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #query #logs #laravel
ADD COMMENT
Topic
Name
9+1 =