-
-
Notifications
You must be signed in to change notification settings - Fork 536
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
Data events #223
Comments
Spock specifically will need access to all the same events that v2 had access to, as well as a singular |
We kinda got lucky with the PagesMoved event in v2. When you reorder pages, we don't actually call any save() methods on the pages, we just move the files around. We'll end up with the same problem in v3. Page reordering would be done with a structure, and we'd just need to call save on that once. Entries though... Maybe a solution could be that the saving event could be aware that its part of a batch update, then Spock could choose to ignore it. First thing that comes to mind is something like this: function reorderEntries($entries)
{
Entry::batched(function () use ($entries) {
// do the saving
});
event(new EntriesReordered());
} |
So Spock would have to have logic for choosing which events to ignore and when? |
What if we used structures to hold order on a reorderable collection, rather than storing the order on each individual entry. I know we're using them for nested trees, but what if you could have |
Yeah, that's actually probably a better option. We could just store an array of IDs in the collection itself instead of using a structure, though. title: My Collection
order: number
items:
- id-of-the-first
- id-of-the-second
- etc |
Yeah the single file approach with IDs makes more sense to me, just as it makes more sense in structures 👍 That said, I still wonder about flat structures, rather than having two different places for storing these structures, and then creating completely separate drag'n'drop interfaces, if we could just disable nesting in the GUI when On a UX note, it'd totally be possible to automate the creation of a structure if they check |
@jesseleite @jasonvarga this has been done right? We can close? |
Ensure all data classes have corresponding events. ie)
EntrySaving
,EntrySaved
,EntryDeleting
,EntryDeleted
, etc.Not sure if we need to implement all of the same model events offered by Laravel, but for the events that we do wish to implement, I've already implemented
EntrySaving
andEntrySaved
as an example.See #55 and this doc for more info.
The text was updated successfully, but these errors were encountered: