fields

The main purpose is to identify the field value to be returned when querying

Specified field

$builder->fields(['id','title'])->get('user_list');

Set alias

$builder->fields(['id','title as notice'])->get('user_list');

Using SQL functions

$builder->fields(['id','SUM(score)'])->get('user_list');

Pass the instructions

Method prototype

function fields($fields)
  • $fields array|String can only pass in a field name if it is not an array