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

philipbaginski's avatar

OrderBy in BelongsTo field

Hi everyone! I'm lost to make order in belongsTo field:

I have A resource with columns name and surname. Index view has: public static $orderBy = ['surname' => 'asc'];

, and it works as should. But in resource B I have field: belongsTo resource A, and when I try to choose from the list resource A, ordering is done by name.

How to order it by surname?

0 likes
2 replies
wingly's avatar

I think this is not currently possible in Nova. If i am correct it will order by the title. Maybe you can try setting the title to the surname instead of name ?

philipbaginski's avatar

Thank you! That's what I did, but I will prefere to have name / surname order in the select field coming from BelongsTo.

Please or to participate in this conversation.