pionl / laravel-eloquent-position Goto Github PK
View Code? Open in Web Editor NEWPosition logic for Eloquent models with minimum setup
License: MIT License
Position logic for Eloquent models with minimum setup
License: MIT License
Hi Martin,
would you mind to allow Laravel 5.4 as a requirement? Or is there some breaking change that your package wouldn't work with Laravel 5.4?
Cheers,
Christian
When an item is deleted, the positions stays the same. Imagine I have 3 entries in the table thus having 3 positions. So when I delete the position number 2, the upcoming positions do not change and start from 2, but I still have positions 1 and 3. Any idea how to fix this?
Hi, can you update to laravel 5.7??
thanks.
Hi Martin,
I am reordering elements belonging to the same parent on the user interface and pass all the ordered elements to a controller. There I am iterating through them and want to set the position according to the positioning in the user interface. Therefore every passed element has a new property 'position'.
foreach ($request->all() as $item) { $contentElement = ContentElement::find($item['id']); $contentElement->setPosition($item['position']); $contentElement->save(); }
But I does not work as I would expect, as not every contentElement gets the value from $item['position']. Some still stay on '0'.
Could you give me a hint how I could achieve that?
Kind regards
Christian
I forked the package to accepts all laravel versions >= 5.1
https://github.com/elshobokshy/laravel-eloquent-position
I left the readme and everything else intact.
composer require elshobokshy/laravel-eloquent-position
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.