Level 61
style="{{ $object->rowColor() }}"
public function rowColor(): string
{
return $this->rowColorMappings()[$this->status] ?? 'yellow';
}
protected function rowColorMappings(): array
{
return [
'status1' => 'color1',
];
}
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Depending on the content in the "status" column, the row should be of a certain color. For example, if the 'status' is 'null', then the row is yellow.
Please or to participate in this conversation.