Skip to content
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

Enhancement HasPosition trait #1351

Closed

Conversation

netzknecht
Copy link
Contributor

@netzknecht netzknecht commented Dec 1, 2023

Adds a HasPosition trait for models that require a (manual) sort key, using a numeric position column in the model's table.

Features:

  • Automatic assignment of the next sort key value if not explicitly defined
  • Automatic checking and, if necessary, correction of invalid sort key values
  • Limiting the validation and correcting the sort key values ​​based on the data of other columns in the table
  • Blueprint macro to add position columns with the required unique constriants in migration files
  • Convert current position columns and values ​​to work with the trait

To do:

  • Add tests
  • If necessary, consider position columns in pivot tables.
  • Documentation

Copy link

vercel bot commented Dec 1, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lunar-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 3, 2023 3:09am

@netzknecht
Copy link
Contributor Author

@glennjacobs and @alecritson, before I spend more time into this, what do you think about using the spatie/eloquent-sortable package for manual sorting instead. It should cover all requirements for lunar and works well with the upcoming admin ui based on filament, even if the example is for filament version 2.

@glennjacobs
Copy link
Contributor

@glennjacobs and @alecritson, before I spend more time into this, what do you think about using the spatie/eloquent-sortable package for manual sorting instead. It should cover all requirements for lunar and works well with the upcoming admin ui based on filament, even if the example is for filament version 2.

Sorry, only just seen this. Yes, I think using Spatie's package could have some advantages, we just need to be careful that it doesn't conflict with anything we may have done, e.g. ordering etc.

Also, you'll want to target 0.8 for this now, thanks.

@glennjacobs glennjacobs added this to the v0.8 milestone Jan 31, 2024
@glennjacobs
Copy link
Contributor

Closing as this PR has had a status of "Draft" for a long time and our focus is now moving to 1.x.

@glennjacobs glennjacobs closed this May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants