Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Failed to sort on Lens view with Tag field #6825

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kichetof opened this issue Apr 18, 2025 · 2 comments
Closed

Failed to sort on Lens view with Tag field #6825

kichetof opened this issue Apr 18, 2025 · 2 comments

Comments

@kichetof
Copy link

Description:

When you add a Tag field to a Lens, you can't sort columns.

[2025-04-18 09:58:49] local.ERROR: Call to undefined method Illuminate\Database\Eloquent\Relations\BelongsToMany::getForeignKey() {"userId":1,"exception":"[object] (BadMethodCallException(code: 0): Call to undefined method Illuminate\\Database\\Eloquent\\Relations\\BelongsToMany::getForeignKey() at /Users/tof/Herd/nova-issue-6806/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php:67)

According to this #6311 (comment), lens should be used to display flattened data, and BelongsToMany isn't flattened. But, I think that Tag field is the "flattened view" of a belongsToMany. What do you think?

Detailed steps to reproduce the issue on a fresh Nova installation:

Uncomment this code and sort UserLens view with any columns.

https://github.com/kichetof/nova-issue-6806/blob/2ea23cd0d1f05b02b3a7d9c3d7efab53eb085982/app/Nova/User.php#L69-L75

This comment has been minimized.

@stale stale bot added the stale label Apr 26, 2025
@crynobone crynobone removed the stale label Apr 26, 2025

This comment has been minimized.

@stale stale bot added the stale label May 1, 2025
@laravel laravel locked and limited conversation to collaborators May 1, 2025
@crynobone crynobone converted this issue into discussion #6839 May 1, 2025

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Projects
None yet
Development

No branches or pull requests

2 participants