Laravel SelectRaw vs DB:Raw

前端 未结 1 380
野的像风
野的像风 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)
提交回复
热议问题