Skip to content

Laravel 6 #324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/vendor
composer.lock
/.idea
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
],
"require": {
"php": ">=5.4.0",
"illuminate/console": "5.*",
"illuminate/database": "5.*",
"illuminate/events": "5.*",
"illuminate/filesystem": "5.*",
"illuminate/support": "5.*"
"illuminate/console": "5.*||6.*",
"illuminate/database": "5.*||6.*",
"illuminate/events": "5.*||6.*",
"illuminate/filesystem": "5.*||6.*",
"illuminate/support": "5.*||6.*"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
Expand Down
5 changes: 3 additions & 2 deletions src/Baum/Generators/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
namespace Baum\Generators;

use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Str;

abstract class Generator {

Expand Down Expand Up @@ -78,7 +79,7 @@ protected function parseStub($stub, $replacements=array()) {
* @return string
*/
protected function classify($input) {
return studly_case(str_singular($input));
return Str::studly(Str::singular($input));
}

/**
Expand All @@ -88,6 +89,6 @@ protected function classify($input) {
* @return string
*/
protected function tableize($input) {
return snake_case(str_plural($input));
return Str::snake(Str::plural($input));
}
}
6 changes: 5 additions & 1 deletion src/Baum/Move.php
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,11 @@ protected function fireMoveEvent($event, $halt = true) {
// but we relay the event into the node instance.
$event = "eloquent.{$event}: ".get_class($this->node);

$method = $halt ? 'until' : 'fire';
if (version_compare(app()->version(), '5.8.0', '>=')) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can compare against 5.4, this method was deprecated there.
But personally I would not check against it. I would make v2.0 require Laravel >=5.4

$method = $halt ? 'until' : 'dispatch';
} else {
$method = $halt ? 'until' : 'fire';
}

return static::$dispatcher->$method($event, $this->node);
}
Expand Down
5 changes: 3 additions & 2 deletions src/Baum/SetMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
namespace Baum;

use \Closure;
use Illuminate\Support\Arr;
use Illuminate\Support\Contracts\ArrayableInterface;
use Baum\Node;

Expand Down Expand Up @@ -128,13 +129,13 @@ protected function mapTreeRecursive(array $tree, $parentKey = null, &$affectedKe
protected function getSearchAttributes($attributes) {
$searchable = array($this->node->getKeyName());

return array_only($attributes, $searchable);
return Arr::only($attributes, $searchable);
}

protected function getDataAttributes($attributes) {
$exceptions = array($this->node->getKeyName(), $this->getChildrenKeyName());

return array_except($attributes, $exceptions);
return Arr::except($attributes, $exceptions);
}

protected function firstOrNew($attributes) {
Expand Down
2 changes: 1 addition & 1 deletion tests/suite/support.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function hmap(array $nodes, $preserve = null) {
} else {
$preserve = is_string($preserve) ? array($preserve) : $preserve;

$current = array_only($node, $preserve);
$current = \Illuminate\Support\Arr::only($node, $preserve);
if ( array_key_exists('children', $node) ) {
$children = $node['children'];

Expand Down