Laravel 5 Eloquent: How to get raw sql that is being executed? (with binded data)

前端 未结 5 1627
栀梦
栀梦 2021-02-06 01:13

Im trying to figure out how to get the raw sql query being executed including the binded data in it. Here is what ive got:

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


        
5条回答
  •  我在风中等你
    2021-02-06 01:33

    Another option is to get the queries from Laravel Debugbar:

    $queries = debugbar()->getCollector('queries');  
    $statements = $queries->collect()['statements'];
    dd($statements);
    

提交回复
热议问题