Skip to content

Commit 57a11bd

Browse files
Laravel 5.3 support (#9)
* Laravel 5.3 support * PHP >=5.6.0 * Quick fix
1 parent 5b7a1e7 commit 57a11bd

File tree

7 files changed

+49
-15
lines changed

7 files changed

+49
-15
lines changed

.release.json

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"non-interactive": false,
3+
"dry-run": false,
4+
"verbose": false,
5+
"force": false,
6+
"pkgFiles": [],
7+
"increment": "patch",
8+
"prereleaseId": null,
9+
"commitMessage": "Release %s",
10+
"tagName": "v%s",
11+
"tagAnnotation": "Release %s",
12+
"buildCommand": false,
13+
"changelogCommand": "git log --pretty=format:'* %s (%h)' `git describe --tags --abbrev=0`..HEAD",
14+
"requireCleanWorkingDir": false,
15+
"src": {
16+
"pushRepo": null,
17+
"beforeStartCommand": false,
18+
"beforeStageCommand": false,
19+
"afterReleaseCommand": false
20+
},
21+
"npm": {
22+
"publish": false,
23+
"publishPath": ".",
24+
"tag": "latest",
25+
"private": false,
26+
"forcePublishSourceRepo": false
27+
},
28+
"github": {
29+
"release": true,
30+
"releaseName": "Release %s",
31+
"tokenRef": "GITHUB_TOKEN"
32+
}
33+
}

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
language: php
22

33
php:
4-
- 5.5
54
- 5.6
5+
- 7.0
66

77
before_script:
88
- curl -s http://getcomposer.org/installer | php

README.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,15 @@ Eloquent Tree is a tree model for Laravel Eloquent ORM.
3030

3131
**Version 2.1 - Laravel 5.1 support**
3232

33+
**Version 3.0 - Laravel 5.3 support**
34+
3335
Begin by installing this package through Composer. Edit your project's composer.json file to require gzero/eloquent-tree.
3436
```json
3537
"require": {
36-
"laravel/framework": "4.2.*",
37-
"gzero/eloquent-tree": "v2.0"
38+
"laravel/framework": "5.3.*",
39+
"gzero/eloquent-tree": "v3.0"
3840
},
39-
"minimum-stability" : "dev"
41+
"minimum-stability" : "stable"
4042
```
4143
Next, update Composer from the Terminal:
4244
```
@@ -45,7 +47,7 @@ composer update
4547
That's all now you can extend \Gzero\EloquentTree\Model\Tree in your project
4648

4749
## Migration
48-
Simply migration with all required columns
50+
Simply migration with all required columns that you could extend by adding new fields
4951
```php
5052
Schema::create(
5153
'trees',
@@ -80,12 +82,12 @@ $sibling->setSiblingOf($child); // New sibling
8082

8183
### Getting tree nodes
8284

83-
Root - returning root node
85+
Leaf - returning root node
8486
```php
8587
$leaf->findRoot();
8688
```
8789

88-
Children - returning flat collection of children. You can use Eloquent query builder.
90+
Children - returning flat collection of children. You can use Eloquent query builder.
8991
```php
9092
$collection = $root->children()->get();
9193
$collection2 = $root->children()->where('url', '=', 'slug')->get();

composer.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111
}
1212
],
1313
"require": {
14-
"php": ">=5.5.9"
14+
"php": ">=5.6.0"
1515
},
1616
"require-dev": {
17-
"orchestra/testbench": "3.1.*",
18-
"phpunit/phpunit": "4.3.*"
17+
"orchestra/testbench": "3.3.*",
18+
"phpunit/phpunit": "5.6.*"
1919
},
2020
"autoload": {
2121
"classmap": [
22-
"src/migrations"
22+
"tests/migrations"
2323
],
2424
"psr-0": {
2525
"Gzero\\EloquentTree\\": "src/"

tests/Test.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@ public function setUp()
1515
{
1616

1717
parent::setUp();
18-
$this->artisan(
19-
'migrate',
18+
$this->loadMigrationsFrom(
2019
[
2120
'--database' => 'testbench',
22-
'--path' => 'migrations',
21+
'--realpath' => realpath(__DIR__ . '/migrations'),
2322
]
2423
);
2524
}
@@ -70,7 +69,7 @@ public function can_create_new_node_as_child()
7069
$this->assertEquals($root->path . $child->id . '/', $child->path, 'Wrong children path!');
7170
$this->assertEquals($root->level + 1, $child->level, 'Wrong children level!');
7271
$this->assertEquals($root->id, $child->parent_id, 'Wrong children parent!');
73-
$this->assertEquals($root, $child->parent, 'Wrong children parent!');
72+
$this->assertEquals($root->path, $child->parent->path, 'Wrong children parent!');
7473
}
7574

7675
/**
File renamed without changes.

0 commit comments

Comments
 (0)