The current method just uses ucfirst(), so a column called max_age would become "Max_age". If we used the makeLabel() method, it would be "Max age":
public function setFromDb()
{
$this->setDoctrineTypesMapping();
$this->getDbColumnTypes();
array_map(function ($field) {
// $this->labels[$field] = $this->makeLabel($field);
$new_field = [
'name' => $field,
'label' => **ucfirst($field),**
'value' => null,
'default' => isset($this->db_column_types[$field]['default']) ? $this->db_column_types[$field]['default'] : null,
'type' => $this->getFieldTypeFromDbColumnType($field),
'values' => [],
'attributes' => [],
'autoset' => true,
];
if (! isset($this->create_fields[$field])) {
$this->create_fields[$field] = $new_field;
}
if (! isset($this->update_fields[$field])) {
$this->update_fields[$field] = $new_field;
}
if (! in_array($field, $this->model->getHidden()) && ! isset($this->columns[$field])) {
$this->columns[$field] = [
'name' => $field,
'label' => **ucfirst($field)**,
'type' => $this->getFieldTypeFromDbColumnType($field),
'autoset' => true,
];
}
}, $this->getDbColumnsNames());
}
I have marked the lines that need amending in bold. both methods are in the same trait so it should be a simple change.
In both cases, they should change to:
$this->makeLabel($field)
Edit: It seems you can't use bold highlighting within a code block. Just look for the double asterisks...
https://github.com/Laravel-Backpack/CRUD/pull/688
@tabacitu :)
It would be nice if we could consistently do "odd" things :)
Closing in favour of #688.