lunar icon indicating copy to clipboard operation
lunar copied to clipboard

Enhancement `HasPosition` trait

Open netzknecht opened this issue 1 year ago • 3 comments

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

Features:

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

To do:

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

netzknecht avatar Dec 01 '23 15:12 netzknecht

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

vercel[bot] avatar Dec 01 '23 15:12 vercel[bot]

@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.

netzknecht avatar Jan 02 '24 22:01 netzknecht

@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 avatar Jan 31 '24 16:01 glennjacobs

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

glennjacobs avatar May 06 '24 21:05 glennjacobs