\DB::connection()->enableQueryLog();

some sql action...

$query = \DB::getQueryLog();
$lastQuery = end($query); dd($lastQuery);
php artisan tinker

DB::listen(function($sql){ var_dump($sql);  });

Inside AppServiceProvider.php add the following to the boot method:

use DB;
use Event; //.. public function boot()
{
if (env('APP_ENV') === 'local') {
DB::connection()->enableQueryLog();
}
if (env('APP_ENV') === 'local') {
Event::listen('kernel.handled', function ($request, $response) {
if ( $request->has('sql-debug') ) {
$queries = DB::getQueryLog();
dd($queries);
}
});
}
}

最新文章

  1. gRPC源码分析0-导读
  2. Java设计模式(二) 工厂方法模式
  3. QT学习笔记4
  4. CMake Error: your CXX compiler: "" was not found
  5. eval解析非标准json
  6. sqlmap参数大全
  7. BZOJ 2173 整数的lqp拆分
  8. 可配置多功能门 SN74LVC1G57, 1G58, 1G97, 1G98, 1G99
  9. 用JDBC查询数据库
  10. jsonString转NSDictionary
  11. [POJ] 1511 Invitation Cards
  12. 浙大玉泉ubuntu L2TP VPN连接设置
  13. 转载自 BotVS 「 珍藏版 」如何搭建一个完整的交易框架
  14. boostrap中模态框显示在阴影之下
  15. xml方式将dataset导出excel
  16. css3 的新属性
  17. hdu 1385 Floyd 输出路径
  18. ueditor百度编辑器的赋值方法
  19. 热烈祝贺阿尔法Go首战告捷
  20. 【洛谷5280】[ZJOI2019] 线段树(线段树大力分类讨论)

热门文章

  1. 获取MSSQL Server中的相关信息(视图、存储过程、触发器、表)
  2. 【HTML5】input类型
  3. 使用github上的开源框架SlidingMenu环境的搭建,以及getSupportActionBar方法不能找到的问题
  4. javascript优化--03高质量编码
  5. Xamarin Anroid开发教程之Anroid开发工具及应用介绍
  6. 结合ItemsControl在Canvas中动态添加控件的最MVVM的方式
  7. http://www.cnblogs.com/Matrix54/archive/2012/05/03/2481260.html
  8. Hadoop科普文——常见的45个问题解答(CSDN)
  9. iphone6来了,我该做点什么(兼容iphone6的方法)
  10. HTML head 头标签