Skip to content

Sorting has no effect when a relation has same class than the model #98

@olivierbaudouin

Description

@olivierbaudouin

Steps to reproduce:

  1. In users migration table:
    $table->foreignId('manager_id')->nullable()->constrained('users');

  2. In User model:
    public function manager(): BelongsTo
    {
    return $this->belongsTo(User::class, 'manager_id')->select('id', 'fullname');
    }

  3. Purity sorting string : 'group.name:asc' -> no effect

All other sorting types on relation are working.

I tried with another Model (Customer that belongs to a group where group is a Customer), and this is the same problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions