Laravel SelectRaw vs DB:Raw

前端 未结 1 381
野的像风
野的像风 2021-02-04 21:36

First:

 DB::table(\'someTable\')
->selectRaw(\'count(*), min(some_field) as someMin, max(another_field) as someMax\')
->get();
         


        
1条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-04 22:14

    As per Laravel's documentation:

    Note: The Laravel query builder uses PDO parameter binding to protect your application against SQL injection attacks. There is no need to clean strings being passed as bindings.

    0 讨论(0)
提交回复
热议问题