Generate The Raw MySQL Query From Laravel Query Builder

后端 未结 14 1503
醉话见心
醉话见心 2021-02-02 12:04

How can i get mysql query of a laravel query

Convert:

App\\User::where(\'balance\',\'>\',0)->where(...)-         


        
14条回答
  •  野的像风
    2021-02-02 13:02

    Try this:

    $results = App\User::where('balance','>',0)->where(...)->toSql();
    dd($results);
    

    Note: get() has been replaced with toSql() to display the raw SQL query.

提交回复
热议问题