I'm cannot retry this query, in QueryBuilder:
select id, lpad(number, 12, 0), lpad(int, 2, 0) from users;
How I can, in the example not function...
DB::table('users') ->select('id', 'lpad(number, 12, 0)', 'lpad(int, 2, 0)' ->get();
CodePudding user response:
You need to use selectRaw
.
DB::table('users')
->selectRaw('id, lpad(number, 12, 0), lpad(int, 2, 0)')
->get();