BadgeColumn -> condition using values from two columns

I'm trying to use BadgeColumn on a table with 'stock' and 'stock_alert' columns and my intention is to paint the 'stock' with a color based on the relationship to the 'stock_alert', my code is as follows:
BadgeColumn::make('stock') ->label('Stocks') ->colors([ 'success', 'danger' => static fn ($stock): bool => $stock === 0, 'primary' => static fn ($stock) => $stock <= DB::select('stock_alert'), ]),
The 'danger' color applies fine when $stock is 0.
But the problem is in comparing $stock with 'stock_alert', I can't get that value.
Was this page helpful?