1

I'm currently working on Laravel-admin project with laravel9.

For instance, If the value = 'error', I want to change the background color of the column. Something like this pic:

enter image description here

My code is this:

        $grid->column('title')->display(function ($title, $column) {
            if ($title !== 'error') {
                return $title;
            }
            return $column->setAttributes(['style' => 'background-color:red;']);
        });

But seems like I can't use setAttributes() method on $column. Also If I use setAttributes(['style' => 'background-color:red;']) the column name(In this case title) become red as well. Any advice would be appreciated.

I read the Laravel-admin document and searched for a solution for hours but I couldn't find any good info.

Kmg Kumar
  • 587
  • 2
  • 20
Mia
  • 11
  • 1

0 Answers0