groupFields
groupFields(array $groups)
Group fields to show them as tabs in the form.
For example:
$crud->groupFields([
'Personal Info' => ['first_name', 'last_name', 'email'],
'Address' => ['address', 'city', 'state', 'zip_code'],
'Other' => ['phone', 'notes']
]);
Note: The keys of the array are displaying the tab names. The values are arrays of field names that will be grouped under each tab.
You can find a fully working example below:
$crud->setTable('customers');
$crud->setSubject('Customer', 'Customers');
$crud->setRead();
$crud->groupFields([
'Personal Info' => ['customerName', 'contactLastName', 'contactFirstName'],
'Address' => ['addressLine1', 'addressLine2', 'city', 'state', 'postalCode', 'country'],
'Other' => ['salesRepEmployeeNumber', 'creditLimit']
]);
$output = $crud->render();
As you will see, when you open an add/edit or read form the fields are grouped into tabs named "Personal Info", "Address", and "Other" in the form.