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

Burano's avatar

Nova 4 "relatableQuery" never being called for BelongsToMany field?

I'm a relatively new user to Nova, so I'm completely open to the fact that I'm just missing something. But I've spent multiple days source diving and digging through issues and I just can't figure it out.

I have this field below. It's a many to many relationship for Users. I want to sort the last_active_at pivot field by default so that the latest is first.

BelongsToMany::make('Users', 'users', User::class)
    ->dontReorderAttachables()
    ->fields(function ($request, $model) {
        return [
            Text::make('Last Active', 'last_active_at')->sortable(),
        ];
    }),

I added the dontReorderAttachables as described below in the docs. https://nova.laravel.com/docs/4.0/resources/relationships.html#disable-ordering-by-title

I then attempt to add relatableQuery or relatableUsers to my parent model, and neither is executed at all, never even called into it. I've done everything according to the docs below so at this point I'm unsure what else to try.

https://nova.laravel.com/docs/4.0/resources/authorization.html#relatable-filtering

I've been attempting to debug why this is the case but I've had no luck and I just have no idea anymore. Is this a bug on Nova's end or am I missing something?

0 likes
0 replies

Please or to participate in this conversation.