Populate field value from database, without period or commas

Hello,

I’m trying to populate some values from the database. The column contains values that have periods or commas. Is there any way to populate these without these?

Example of a value:
{{ table.name }} -> First.Name

In JavaScript, I would do this:
var mystring = 'okay.this.is.a.string'; mystring = mystring.replace(/\./g,' ')

Thanks in advance!

Not sure if I understand exactly the situation, is it the table names that are bad, column names, or data within the columns?

I’m going to assume it’s the data because the rest sounds like sheer insanity :slight_smile:

Sounds like you want mutators.

in this case probably getters, though computed may make sense as well…

'use strict'

const Model = use('Model')

class Person extends Model {
  getFirstName (first_name) {
    return first_name.replace(/\./g, ' ')
  }
}

If you need something more involved, you might want to check out adonis-bumblebee