Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Laravel Backpack uppercase

I am trying to have a column where

  • the text is in upper case
  • and the column is orderable.

If I am doing this through an accessor, then this won’t be a tableColumn and it won’t be orderable. So this wont work.

Next I am trying to find a way to make it uppercase in blade?
For example, I am setting a column->toUpper = true;

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

     $this->crud->addColumn(
        [
            'name'      => 'country',
            'label'     => 'Country,
            'type'      => 'text',
            'toUpper'   => true
        ]);

Where in blade can I search for this and transform the value?

Or how should I do this? Looks like an easy task but I cant find it in the docs.

>Solution :

You can use

CRUD::column('text_and_email')
        ->type('model_function')
        ->label('Text and Email')
        ->function_name('getUpperText')

And add in model function

public function getUpperText() {
    return strtoupper($this->field);
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading