atayahmet / laravel-nestable

Laravel 5 nested category/menu generator
MIT License
214 stars 52 forks source link

PHP 7.2.0 Issue on NestableService.php #40

Closed wakamin closed 6 years ago

wakamin commented 6 years ago

I upgrade to PHP 7.2.0 and facing this error

count(): Parameter must be an array or an object that implements Countable on vendor/atayahmet/laravel-nestable/src/Services/NestableService.php line 406

Then to fix this, I change this

if (count(func_num_args()) < 3) {
    $data = $this->data;
    $key = $this->parent;
    $value = current(func_get_args());
}

into this

if (func_num_args() < 3) {
    $data = $this->data;
    $key = $this->parent;
    $value = current(func_get_args());
}

Let me know if there is a better solution. Thanks.

atayahmet commented 6 years ago

Hi @wakamin

Fixed. Thank you for contribution. Update the package.