https://stackoverflow.com/questions/34408900/laravel-selectraw-vs-dbraw maybe this can help you
Mar 20, 2016
3
Level 1
DB:raw,selectraw Are they the same?
HI there , I just learn Laravel for 3 months and confuse the "DB:raw" and "selectraw", what is the different between them? when I wrote the query below $users = bicmappingdata::selectraw('sum(qty) as qty,salename,cusname')->where('SaleType', '=','A2')->GroupBy('salename','cusname')->get();
the result would be the same like below
$users = bicmappingdata::select(DB::raw('sum(qty) as qty'),'salename','cusname')->where('SaleType', '=','A2')->GroupBy('salename','cusname')->get();
What is the different between "DB:raw" and "selectraw" and which one is better to use?
Please or to participate in this conversation.