fieldTypeColumn(string $columnName, string|ModelFieldType $fieldType)

This function is used for cases that you need to change the field type but only for the column (e.g. not for add/edit/read form). You can choose any field type from the list of field types.


Let's say that we need to show a field that by default is datetime field but on the columns we would like to show it as date (remove the time from the columns).

In order to do that any of the of the below 2 examples have the exact same results:

$crud->fieldTypeColumn('order_datetime', GroceryCrud::FIELD_TYPE_DATE);


$crud->fieldTypeColumn('order_datetime', 'date');

And the above example will safely change the fieldType but only for the columns of the datagrid.


$crud->setSubject('Order', 'Orders');

// We are hiding requiredDate only on the columns. We can edit or
// filter the value of requiredDate
$crud->fieldTypeColumn('requiredDate', 'invisible');