readFields

readFields(array $readFields)

The fields that will be visible when the end-user navigates to the view form.

For example:

$crud->readFields(['first_name', 'last_name', 'fullname', 'address'])

Note: It is important to know that by default the read/view button is hidden. This is mainly for the reason that it is not commonly used. If you want to enable it you will need to simply add the code: $crud->setRead();.

You can find a fully working example below:

$crud->setTable('customers');
$crud->setRead();
$crud->setSubject('Customer', 'Customers');
$crud->readFields(['customerName','phone','addressLine1','creditLimit']);

$output = $crud->render();

As you will see, only when the button view is pressed (go to any row and press "More" -> "View") the fields are less than when we press "Add" or "Edit". When the View form is opened then only the fields that are mentioned at the readFields function are visible.