Download the PHP package gurgentil/laravel-eloquent-sequencer without Composer
On this page you can find all versions of the php package gurgentil/laravel-eloquent-sequencer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gurgentil/laravel-eloquent-sequencer
More information about gurgentil/laravel-eloquent-sequencer
Files in gurgentil/laravel-eloquent-sequencer
Package laravel-eloquent-sequencer
Short Description A package that allows you to create and manage sequences on Eloquent models
License MIT
Homepage https://github.com/gurgentil/laravel-eloquent-sequencer
Informations about the package laravel-eloquent-sequencer
Laravel Eloquent Sequencer
This package allows you to create and manage sequences for your Eloquent models.
Installation
Install the package via composer:
Configuration
To publish the configuration file run:
Configuration parameters
You can change the default colum name, the initial value and the sequencing strategy in config/eloquentsequencer.php
:
The strategy
configuration determines when sequencing should be triggered and accepts one of the following values: always
, on_create
, on_update
or never
.
Model configuration
The $sequenceable
attribute specifies the sequence column name for the model:
The relationship key(s) that will group the sequence items together:
In the example above, a task list has many tasks.
For polymorphic relationships specify both relationship keys:
Usage
In the example below, a task list may have many tasks.
Create an object
If no value is provided for the sequence attribute, the object will be placed at the end of the sequence.
Update and delete objects
The other items in the sequence will be rearranged to keep the sequence consistent.
Get sequence value of an object
Get sequence column name
Disable automatic sequencing
Scope query to order results by sequence value
Artisan commands
Assign sequence values to all records that have their values set to null
.
Flush all sequence values for a model.
Testing
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Gustavo Rorato Gentil
- Michael Slowik
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
Laravel Package Boilerplate
This package was generated using the Laravel Package Boilerplate.