Support the ongoing development of Laravel.io →
Eloquent Packages
Last updated 2 years ago.
0

Sorry for the dumb dumb question but is something like what jquery table does?

Last updated 2 years ago.
0

I wouldn't think so. jQuery operates on the client and is not inherently tied to the data layer. Most table plugins just provide a nice GUI, but a backend must still be written to store the data. Listify is the backend structure to keep data sorted persistently. Listify works directly with Eloquent at the data layer to keep associated data ordered.

As an example, I've used Listify to allow sorting of images in the admin portion of a webapp that must be rendered in a certain order on the frontend. Storing and manipulating the order was a critical piece. So, Listify can not only apply to tabular data, but to any resource that needs to be ordered persistently.

Hope that helps!

Last updated 2 years ago.
0

Yes, that does! Thanks!

Last updated 2 years ago.
0

So let me just give a quick example and tell me if I'm thinking this correctly.

If I have some texts in a category and they are sorted by a position. By moving one to let's say position 3 from position 8, it will then update all the other text's positions? So I need to actually just worry about the new text position and everything else is done in the background?

If that is the case, this is a perfect package for my CMS.

Also a quick question. How do you handle (if at all) if the position is linked also to another column. For example I have templates pivot table for a category and I get position based on the type of the template. So basically when I'd be doing an update on the position it should also put the "type" in the where clause.

Also, how could I enable Listify on a pivot table? Do I need to create an Eloquent model in any case?

Thanks for all the answers, great work!

Last updated 2 years ago.
0

Yes, your example is correct. You would simply need to update the index of the one record, and the others would shift appropriately.

The package as it stands does not handle the position being based on a dependency unless it can be described in the scope. So, if the scope is based on a given type, then the position of that record would be tied to the type. The docs have pretty good info on how the scope config works and which types of scopes can be used. It's pretty flexible, and likely you'll be able to solve your problem.

As for the pivot table, Listify depends on the model being an implementation of Eloquent. So, you couldn't use it directly in a pivot table, but rather you'd use it on the model itself. Put another way, a given record using Listify can only have a single position at a time. There is no support for multiple position columns with independent scopes.

Hope that helps!

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.