Position reordering not working
Hi!
I am checking Twill out to see if it's a match for our next project. It looks really promising but I walked into a small problem with the first guide "Building a simple page builder with Laravel Blade".
I've successfully ran through it but the section "Adding navigation" gives me a small problem, the code works fine and gives no errors or whatsoever. However, the frontend does not work. When I drag a menu item to a new position or drag it to be a child of another item the frontend will reply that the order has been changed, yet when I reload there is no change. The response of the xhr request contains:
variant: 'success'
, it's just that the database is not updating and reflecting the changes.
If I change the values in the database myself the frontend reflects those and it works nicely. But I'm not so keen on changing on positions by hand all the time π
Can anyone point me in a direction on where to look / debug this issue?
Thanks!5 Replies
hi @MAD reordering in nested modules is using a queued job for data integrity.
php artisan queue:work
running in the background will execute them and update the database.@ifox Awesome, that was it! Thank you very much, that information was absent in the guide π
(Or I missed it)
But now that we are at it, would you happen to have an idea what happens here?
The order above is not reflected when retreiving the order like this:
Actual output:
Your tree might be broken because of your manual edits. And you're also supposed to call ordered() before toTree, IIRC. Check the laravel nested-set package docs. Sorry I'm on mobile.
I'll make sure to update the guide with your feedback, sorry about that
Of course, it's a Laravel collection.. Thanks for that!
It wasn't my edits (just started with new data) it was the
->ordered()
call. So far so good, I'll experiment around with it some more.
Thanks for the awesome work, code and project [AT]twill people!