Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

EckyEckyPtang's avatar

Sort value different from displayed value?

I have this in the Nova fields method:

Number::make('views', function() {
  		return 'something: ' . number_format('views') . 'x';
})->sortable();

I want to sort by the raw views value in the database, while display some string version that formatted the views count. Is this possible?

0 likes
1 reply

Please or to participate in this conversation.