Skip to content

contentClasses() #1637

Discussion options

You must be logged in to vote
public function fields(): PowerGridFields
    {
        return PowerGrid::fields()
            ->add('id')
            ->add('etat', function ($order) {
                $etatClasses = [
                    'mid' => 'bg-blue-100 text-blue-800',
                    'good' => 'bg-green-100 text-green-800',
                    'bad' => 'bg-red-100 text-red-800',
                    'default' => 'bg-gray-100 text-gray-800',
                ];
                $classes = $etatClasses[$order->etat] ?? 'bg-gray-100 text-gray-800'; // Default
                $commonClasses = 'text-xs font-medium me-2 px-2.5 py-0.5 rounded';
                return Blade::render('<span class="' . $classes . ' ' . $co…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by SfaygaTheKing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant