Skip to content
Discussion options

You must be logged in to vote

Sure, just put that sent value in a wrapper attribute like I suggested.

CRUD::column('my_column')->wrapper([
    'my-custom-attribute' => function ($crud, $column, $entry, $related_key){
        $defaultColor = match($entry->sent) {
            1 => 'yellow',
            2 => 'green',
        };
        return $entry->cancelled ? 'red' : $defaultColor;
    }]);

You will endup with a my-custom-attribute="red/yellow/green" in your column wrapper.
Search those and apply that color to the tr.

Cheers

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@AdamovicBoban
Comment options

Comment options

You must be logged in to vote
3 replies
@AdamovicBoban
Comment options

@pxpm
Comment options

pxpm Nov 27, 2023
Maintainer

Answer selected by AdamovicBoban
@AdamovicBoban
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants