Skip to content

Commit

Permalink
L5.3 Support
Browse files Browse the repository at this point in the history
  • Loading branch information
adammatysiak committed Feb 20, 2018
1 parent d74ae0d commit f7e69ac
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 15 deletions.
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Eloquent Sequence ![CircleCI](https://circleci.com/gh/highsolutions/eloquent-sequence.svg?style=svg) ![StyleCI](https://styleci.io/repos/61547910/shield?branch=master)
Eloquent Sequence
================

![CircleCI](https://circleci.com/gh/highsolutions/eloquent-sequence.svg?style=svg) ![StyleCI](https://styleci.io/repos/61547910/shield?branch=L5.3) [![License: MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg?style=flat-square)](https://opensource.org/licenses/MIT)

Easy creation and management sequence support for Eloquent models with elastic configuration.

![Eloquent-Sequence by HighSolutions](https://raw.githubusercontent.com/highsolutions/eloquent-sequence/master/intro.jpg)
Expand All @@ -18,12 +20,21 @@ Or by adding the following line to the `require` section of your Laravel webapp'

```javascript
"require": {
"HighSolutions/eloquent-sequence": "2.*"
"HighSolutions/eloquent-sequence": "2.3.*"
}
```

Run `composer update` to install the package.

Version Compatibility
----------------------

Laravel | Eloquent-Sequence
:---------|:----------
5.1.x | 2.1.x
5.2.x | 2.2.x
5.3.x | 2.3.x

Updating Eloquent models
------------------------

Expand Down Expand Up @@ -228,6 +239,15 @@ vendor/bin/phpunit
Changelog
---------

2.3.0
- Laravel 5.3 support

2.2.0
- Laravel 5.2 support

2.1.0
- Laravel 5.1 support

2.0.3
- add StyleCI and CircleCI support

Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
"license": "MIT",
"require": {
"php": ">=5.6.4",
"illuminate/console": "~5.5.0",
"illuminate/console": "~5.3.0",
"illuminate/support": "~5.1"
},
"require-dev": {
"phpunit/phpunit": "^6.2",
"orchestra/testbench" : "~3.5.0",
"mockery/mockery": "^1.0"
"phpunit/phpunit": "~5.0",
"orchestra/testbench" : "~3.3.0",
"mockery/mockery": "0.9.*"
},
"autoload": {
"psr-4": {
Expand All @@ -34,7 +34,7 @@
},
"extra": {
"component": "package",
"frameworks": ["Laravel 5.5"]
"frameworks": ["Laravel 5.3"]
},
"minimum-stability": "stable"
}
11 changes: 7 additions & 4 deletions src/SequenceService.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ private function moveObject($secondObj)
if ($this->getSequenceConfig('exceptions')) {
throw new ModelNotFoundException();
}

return $this->obj;
}

Expand Down Expand Up @@ -347,8 +348,9 @@ protected function moveFurther($position)
->where($this->getSequenceConfig('fieldName'), '<=', $position)
->sequenced()
->get()
->each
->decrement($this->getSequenceConfig('fieldName'));
->each(function ($item) {
$item->decrement($this->getSequenceConfig('fieldName'));
});

$this->setSequence($this->obj, $position <= $max ? $position : $max);

Expand Down Expand Up @@ -376,8 +378,9 @@ protected function moveEarlier($position)
->where($this->getSequenceConfig('fieldName'), '<', $currentSequence)
->sequenced()
->get()
->each
->increment($this->getSequenceConfig('fieldName'));
->each(function ($item) {
$item->increment($this->getSequenceConfig('fieldName'));
});

$this->setSequence($this->obj, $position < 1 ? 1 : $position);

Expand Down
7 changes: 3 additions & 4 deletions tests/SequenceTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace HighSolutions\EloquentSequence\Test;

use Illuminate\Support\Collection;
use HighSolutions\EloquentSequence\Test\Models\SimpleModel;

abstract class SequenceTestCase extends TestCase
Expand All @@ -16,9 +15,9 @@ protected function setClass($class)

protected function create($count, $params = [])
{
Collection::times($count, function ($number) use ($params) {
$this->newModel($params, 'Model #'.$number);
});
for ($i = 0; $i < $count; $i++) {
$this->newModel($params, 'Model #'.($i + 1));
}
}

protected function newModel($params = [], $name = null)
Expand Down
4 changes: 4 additions & 0 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public function setUp()
parent::setUp();

$this->setUpDatabase();

if (version_compare(PHP_VERSION, '7.2.0', '>=')) {
error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING);
}
}

protected function checkRequirements()
Expand Down
Binary file modified tests/temp/database.sqlite
Binary file not shown.

0 comments on commit f7e69ac

Please sign in to comment.