Download the PHP package alik-laravel/ordering without Composer
On this page you can find all versions of the php package alik-laravel/ordering. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download alik-laravel/ordering
More information about alik-laravel/ordering
Files in alik-laravel/ordering
Package ordering
Short Description Laravel package for ordering functionality
License MIT
Homepage https://github.com/alik-laravel/ordering
Informations about the package ordering
Laravel Ordering
A simple Laravel package that provides ordering functionality for Eloquent models. Add the HasOrdering trait to any model to automatically handle ordering with scope support.
Installation
You can install the package via composer:
Requirements
- PHP 8.2+
- Laravel 10.0+ or 11.0+
Usage
1. Add the trait to your model
2. Add an order column to your migration
3. Automatic ordering
Models with the HasOrdering trait will:
- Automatically be ordered by the
ordercolumn - Get the next available order value when created
- Provide methods for reordering
4. Manual ordering operations
5. Scoped ordering
You can work with ordering within specific scopes:
6. Controller implementation for drag-and-drop
Here's how to implement a controller action to handle drag-and-drop reordering from a frontend component:
Frontend JavaScript example
With scoped ordering
If you need to maintain ordering within a specific scope (e.g., same category):
Testing
Run the test suite:
Run tests with coverage:
Code Quality
Format code with Laravel Pint:
Run static analysis with Larastan:
Refactor code with Rector:
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Aleksandr Manukyan
- All Contributors
License
The MIT License (MIT). Please see License File for more information.