Download the PHP package yusufalper/laravel-order without Composer
On this page you can find all versions of the php package yusufalper/laravel-order. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download yusufalper/laravel-order
More information about yusufalper/laravel-order
Files in yusufalper/laravel-order
Package laravel-order
Short Description #todo: description will be here
License MIT
Homepage https://github.com/yusufalper/laravel-order
Informations about the package laravel-order
Package Summary
This Laravel package provides a handy trait called HasOrder designed to simplify the management of ordered records in your Eloquent models. By applying this trait to your models, you introduce an 'order' attribute, allowing you to effortlessly handle the ordering of records within a given model.
Installation
You can install the package via composer:
Usage
-
Apply Trait: Simply apply the HasOrder trait to your Eloquent model. Ensure that your model's migration includes a column (integer and nullable) specified in model as '$orderAttrName' (see example in below) to support the ordering functionality.
-
Optional Configuration: Define $orderUnificationAttributes (public array) within your model to fine-tune the ordering behavior according to your application's specific requirements. For example if you add 'user_id' attribute to $orderUnificationAttributes, then your ordering will be user_id based ordering.
-
Automatic Handling: The package takes care of automatic order adjustments during record creation, ensuring a seamless and organized ordering process.
- Effortless Update and Delete: The HasOrder trait also seamlessly handles updates and deletes, maintaining the correct order of records based on your defined criteria.
Example Usage
If you have multiple traits that each of which has a boot method, Then you should use like this:
By integrating the HasOrder trait into your Laravel models, you streamline the process of managing ordered records, offering enhanced control and flexibility.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-order with dependencies
spatie/laravel-package-tools Version ^1.14.0
illuminate/contracts Version ^10.0