Skip to content

relatable query not applying to belongsto #5743

@jdion84

Description

@jdion84
  • Laravel Version: 10
  • Nova Version: 4
  • PHP Version: 8
  • Database Driver & Version: mysql
  • Operating System and Version: mac
  • Browser type and version: chrome

Description:

i am trying to sort the select dropdown for belongsto relationship

in my Lead resource, i have a belongsto field:

                BelongsTo::make('Status')
                    ->dontReorderAssociatables()

i have tried using the relatable query method to sort the select:

    public static function relatableQuery(NovaRequest $request, $query)
    {
        return $query->orderBy('order');
    }

it does not sort the Status belongsto select by what i am specifying

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions